How to plot values of a matrix?
Ältere Kommentare anzeigen
I have attached my code below. I want to plot the values of 'steadystate' during the while loop as 4 different lines on the same plot. How do I do that?
while abs(steadystate-concoutGuess)>0.0000001
bigmatrix=alt_bigmatrix;
concoutGuess=steadystate;
concout=steadystate;
fA= ((flowinA*concinA-flowout*concout(1))/Vol) - k1*concout(1)*concout(2);
fB= ((flowinB*concinB-flowout*concout(2))/Vol) - k1*concout(1)*concout(2) - k2*concout(2)*concout(3);
fC= ((-flowout*concout(3))/Vol) + k1*concout(1)*concout(2) - k2*concout(2)*concout(3);
fD= ((-flowout*concout(4))/Vol) + k1*concout(2)*concout(3);
molflow = [ fA; fB; fC; fD ];
bigmatrix= subs(bigmatrix);
differential=inv(bigmatrix);
differential=vpa(differential,8);
molflow=vpa(molflow,8);
steadystate = concoutGuess - (differential*molflow);
steadystate = vpa(steadystate,8)
end
Antworten (1)
Image Analyst
am 21 Apr. 2018
0 Stimmen
Have you tried the plot() function?
What did you intialize steadystate and concoutGuess with, so we can try your code?
4 Kommentare
Remston Martis
am 21 Apr. 2018
Bearbeitet: Remston Martis
am 21 Apr. 2018
Image Analyst
am 21 Apr. 2018
This does not work:
concoutGuess = [0.1;0.1;0.1;0.1] while abs(steadystate-concoutGuess)>0.0000001 bigmatrix=alt_bigmatrix; concoutGuess=steadystate; concout=steadystate; fA= ((flowinA*concinA-flowout*concout(1))/Vol) - k1*concout(1)*concout(2); fB= ((flowinB*concinB-flowout*concout(2))/Vol) - k1*concout(1)*concout(2) - k2*concout(2)*concout(3); fC= ((-flowout*concout(3))/Vol) + k1*concout(1)*concout(2) - k2*concout(2)*concout(3); fD= ((-flowout*concout(4))/Vol) + k1*concout(2)*concout(3); molflow = [ fA; fB; fC; fD ]; bigmatrix= subs(bigmatrix); differential=inv(bigmatrix); differential=vpa(differential,8); molflow=vpa(molflow,8); steadystate = concoutGuess - (differential*molflow); steadystate = vpa(steadystate,8) end
because you didn't give the intial values for steadystate. Again, what did you initialize steadystate to?
Remston Martis
am 21 Apr. 2018
Bearbeitet: Remston Martis
am 21 Apr. 2018
Image Analyst
am 22 Apr. 2018
Sorry, I don't have the Symbolic Math toolbox. I've added it to the Products list on the upper right so others will know.
Kategorien
Mehr zu Chemical Process Design finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!