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

17 views (last 30 days)
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?

Answers (2)

Star Strider
Star Strider on 23 Apr 2016
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 on 23 Apr 2016
Don't use rref, use null instead.

Categories

Find more on Matrix Decomposition in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!