How to plot values of a matrix?
이전 댓글 표시
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
답변 (1개)
Image Analyst
2018년 4월 21일
0 개 추천
Have you tried the plot() function?
What did you intialize steadystate and concoutGuess with, so we can try your code?
댓글 수: 4
Remston Martis
2018년 4월 21일
편집: Remston Martis
2018년 4월 21일
Image Analyst
2018년 4월 21일
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
2018년 4월 21일
편집: Remston Martis
2018년 4월 21일
Image Analyst
2018년 4월 22일
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.
카테고리
도움말 센터 및 File Exchange에서 Chemical Process Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!