How to solve an augmented matrix using rref(A)?

17 次查看(过去 30 天)
Given this set of equations:
0.25pF + 0.15pT + 0.25pC + 0.18pCM + 0.20pSB = pF
0.15pF + 0.28pT + 0.18pC + 0.17pCM + 0.05pSB = pT
0.22pF + 0.19pT + 0.22pC + 0.22pCM + 0.10pSB = pC
0.20pF + 0.15pT + 0.20pC + 0.28pCM + 0.15pSB = pCM
0.18pF + 0.23pT + 0.15pC + 0.15pCM + 0.50pSB = pSB
we were asked to use Matlab to find pF, pT, pC, pCM, pSB.
the code I have so far is: C=[0.25 0.15 0.25 0.18 0.20; 0.15 0.28 0.18 0.17 0.05; 0.22 0.19 0.22 0.22 0.10; 0.20 0.15 0.20 0.28 0.15; 0.18 0.23 0.15 0.15 0.5]
%If the price of the items are denoted by the matrix p, then the linear relationship would be Cp=p %or equivalently Cp-p= Cp-Ip= (C-I)p=0 (where I is an identity matrix with 1's on the diagonal and o's everywhere else.)
I=eye(5)
d=[0; 0; 0; 0; 0]
%Therefor this can be represented as the augmented matrix [(C-I)|d]
M=rref([(C-I)d])
But this produces an error: of an unexpected MatLab expression, what am I doing wrong? how do I use rref to solve the augmented matrix?

回答(2 个)

Star Strider
Star Strider 2016-4-23
You must have a typo somewhere.
This runs for me without error:
C=[0.25 0.15 0.25 0.18 0.20; 0.15 0.28 0.18 0.17 0.05; 0.22 0.19 0.22 0.22 0.10; 0.20 0.15 0.20 0.28 0.15; 0.18 0.23 0.15 0.15 0.5];
I=eye(5);
d=[0; 0; 0; 0; 0];
Ca = [C-I d];
M = rref(Ca);
The solved coefficients appear to be in ‘M(:,5)’.

Steven Lord
Steven Lord 2016-4-23
Don't use rref, use null instead.

类别

Help CenterFile Exchange 中查找有关 Matrix Decomposition 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by