The line for my graph isn't showing. Also, only the 'van der Waals equation' shows up on my legend.

1 回表示 (過去 30 日間)
Corey Smith
Corey Smith 2017 年 9 月 25 日
回答済み: Niraj Gadakari 2017 年 9 月 28 日
x=(1*0.08206*373.15)./0.06706468 y=-(3.592*1*0.04267)./((0.08206*373.15*0.04267)-3.592) plot(x,y) xlabel('Volume, (L)') ylabel('Pressure, (atm)') axis([0 1 0 400]) legend('van der Waals equation','Ideal Gas equation')

回答 (1 件)

Niraj Gadakari
Niraj Gadakari 2017 年 9 月 28 日
In the code there is no line. You just have a scalar value x = 456.5844, y = 0.0671.
If one of X or Y is a scalar and the other is either a scalar or a vector, then the plot function plots discrete points. However, to see the points you must specify a marker symbol, for example, plot(X,Y,'o'). Refer to the documentation for plot function.
Also, you are setting the axis limit beyond the data point.
You can see your data point by executing the following code:
x=(1*0.08206*373.15)./0.06706468;
y=-(3.592*1*0.04267)./((0.08206*373.15*0.04267)-3.592);
plot(x,y,'o')
xlabel('Volume, (L)')
ylabel('Pressure, (atm)')

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by