Results 1 to 3 of 3

Math Help - Matlab help can't write script

  1. #1
    Junior Member
    Joined
    Feb 2009
    Posts
    29

    Matlab help can't write script

    Q-2e One type of candy costs 60 cents a pound while a second type costs 80 cents a pound. How many pounds of each type must be combined in order to produce 20 pounds of a mixture worth 75 cents a pound?


    I got the answer though,
    type 1 =x
    type 2 =y
    x+y=20
    y=20-x


    60x+80y=75(x+y)
    60x+80y=75x+75y
    simplify
    5y=15x
    sub in y=20-x
    5(20-y)=15x
    100-5x=15x
    100=20x
    x=5
    plug 5 into y=20-x
    y=15


    Could someone help me form a matlab script?
    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 Mathhelpz View Post
    Q-2e One type of candy costs 60 cents a pound while a second type costs 80 cents a pound. How many pounds of each type must be combined in order to produce 20 pounds of a mixture worth 75 cents a pound?


    I got the answer though,
    type 1 =x
    type 2 =y
    x+y=20
    y=20-x


    60x+80y=75(x+y)
    60x+80y=75x+75y
    simplify
    5y=15x
    sub in y=20-x
    5(20-y)=15x
    100-5x=15x
    100=20x
    x=5
    plug 5 into y=20-x
    y=15


    Could someone help me form a matlab script?
    You have the pair of equations:

    x+y=20

    60x+80y=75\times 20

    or in matrix form:

    \left[ \begin{array}{cc}1&1\\60&80\end{array}\right] \left[ \begin{array}{c}x\\y \end{array} \right] = \left[ \begin{array}{c}20\\1500 \end{array} \right]

    So is we set:

     <br />
\bold{x}= \left[ \begin{array}{c}x\\y \end{array} \right] <br />

    We can write:

    Code:
    A=[1,1;60,80];
    Z=[20;1500]
     
    X=A\Z
    or of you prefer:


    Code:
    A=[1,1;60,80];
    Z=[20;1500]
     
    X=inv(A)*Z
    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Feb 2009
    Posts
    29
    thank you very much@!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. matlab Script for Finite Difference method
    Posted in the Math Software Forum
    Replies: 1
    Last Post: September 1st 2011, 10:24 PM
  2. Trying to script the General Beta 2 CDF in MATLAB
    Posted in the Math Software Forum
    Replies: 2
    Last Post: July 18th 2011, 11:55 AM
  3. is there a way to kill a script in matlab?
    Posted in the Math Software Forum
    Replies: 3
    Last Post: August 6th 2010, 04:21 AM
  4. Help with Matlab Script
    Posted in the Math Software Forum
    Replies: 1
    Last Post: April 25th 2010, 08:25 PM
  5. MATLAB and using the script for RK4 method
    Posted in the Math Software Forum
    Replies: 1
    Last Post: April 8th 2009, 03:33 AM

Search Tags


/mathhelpforum @mathhelpforum