Originally Posted by
Mathhelpz 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:
or in matrix form:
So is we set:
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