Results 1 to 2 of 2

Math Help - Need help with MATLAB question

  1. #1
    Newbie
    Joined
    Feb 2010
    Posts
    3

    Need help with MATLAB question

    ok so the question is

    The dissolution of copper sulfide in aqueous nitric acid is described by the following chemical equation

    aCuS + bNO3^- + cH^+ = dCu^2+ + eSO4^2- + fNO + gH2O

    where the coefficients a,b,c,d,e,f, and g are the numbers of each molecule participating in the reactiona nd are unknown. THe unknown coefficients are determined by balancing each atom on left and right and then balancing the ionic charge. The resulting equations are:

    a=d, a=e, b=f, 3b=4e+f+g, c=2g, -b+c=2d-2e

    There are seven unknowns and only six equations. A solution can still be obtained, however, by taking advantage of the fact that all the coefficients must be positive integers, Add a 7th equation by guessing a=1 and solve the system of equations. The solution is valid if all the coefficients are positive integers. If this is not the case take a=2 and repeat the solution. Continue the process until all the coefficients in the solution are positive integers.


    I know how to solve the problem normally but do know how to do this in matlab. At first I tried to just type in all the equations into matlab and solve but that didn't work. Or am I supposed to set up a matrix? I don't know where to begin with this problem. Thanks
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by truong123 View Post
    ok so the question is

    The dissolution of copper sulfide in aqueous nitric acid is described by the following chemical equation

    aCuS + bNO3^- + cH^+ = dCu^2+ + eSO4^2- + fNO + gH2O

    where the coefficients a,b,c,d,e,f, and g are the numbers of each molecule participating in the reactiona nd are unknown. THe unknown coefficients are determined by balancing each atom on left and right and then balancing the ionic charge. The resulting equations are:

    a=d, a=e, b=f, 3b=4e+f+g, c=2g, -b+c=2d-2e

    There are seven unknowns and only six equations. A solution can still be obtained, however, by taking advantage of the fact that all the coefficients must be positive integers, Add a 7th equation by guessing a=1 and solve the system of equations. The solution is valid if all the coefficients are positive integers. If this is not the case take a=2 and repeat the solution. Continue the process until all the coefficients in the solution are positive integers.


    I know how to solve the problem normally but do know how to do this in matlab. At first I tried to just type in all the equations into matlab and solve but that didn't work. Or am I supposed to set up a matrix? I don't know where to begin with this problem. Thanks
    Create a loop to loop over integer values for a and break out of the loop when the solution for the remaining variables meets your requirements.

    To do the tests you will need a function to tell you if a double-prescission variable contains something to the limits of calculation can be considered an integer. Something like:

    Code:
    function rv=isintdd(x)
    %
    %  warning untested code follows
    %
      xx=round(x);
      if abs((xx-x)/x)<1e-7
         rv=1
      else
         rv=0
      end
    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Question in MATLAB
    Posted in the Math Software Forum
    Replies: 17
    Last Post: December 27th 2011, 01:57 PM
  2. Question in matlab
    Posted in the Math Software Forum
    Replies: 5
    Last Post: January 8th 2011, 04:07 AM
  3. Question in matlab
    Posted in the Math Software Forum
    Replies: 2
    Last Post: December 24th 2010, 11:32 AM
  4. A Matlab Question
    Posted in the Math Software Forum
    Replies: 2
    Last Post: August 8th 2009, 12:02 AM
  5. Hello - Matlab question
    Posted in the Math Software Forum
    Replies: 1
    Last Post: May 3rd 2009, 10:59 PM

Search Tags


/mathhelpforum @mathhelpforum