How to plot values of a matrix?
Mostrar comentarios más antiguos
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
Respuestas (1)
Image Analyst
el 21 de Abr. de 2018
0 votos
Have you tried the plot() function?
What did you intialize steadystate and concoutGuess with, so we can try your code?
4 comentarios
Remston Martis
el 21 de Abr. de 2018
Editada: Remston Martis
el 21 de Abr. de 2018
Image Analyst
el 21 de Abr. de 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
el 21 de Abr. de 2018
Editada: Remston Martis
el 21 de Abr. de 2018
Image Analyst
el 22 de Abr. de 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.
Categorías
Más información sobre Chemical Process Design en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!