Matlab Plotting Question: No graphs
이전 댓글 표시
.jpeg)
.png)
Hello Everyone, I am trying to plot the below equilibrium curve by using the plot shown. However, my code does not work.
Is there anything that I missed? Thank you for your help! :)
댓글 수: 1
Shubham Gupta
2019년 11월 8일
your x1 & y1 are scalars. which is being plotted as a point on the graph.
plot(x1,y1,'r*')
Above code will show "red asterisk" at that point. But I sure you want x1 & y1 to be vectors, which you won't get unless you use vectors to calculate x1 & y1.
채택된 답변
추가 답변 (1개)
Artemio Soto Breceda
2019년 11월 8일
Your problem is that x1 is a single value, rather than an array. It is actually plotting something, but it is just 1 single dot per element of y1. Try this and you will see what I mean:
plot(x1,y1,'o');
I believe that your problem would be fixed if you use the dot (.) operator to define x1:
x1 = ((P-P2sat)./(P1sat-P2sat)); % This makes x1 an array, instead of a single value
y1 = (P1sat/P).*x1; % Then you need to use the dot (.) operator on this line as well
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!