Plotting does not work well.

Code :
---------------------------------
T= 323.15;
A1= 4.01814;
B1= 1203.835;
C1= -53.226;
A2= 4.08245;
B2= 1346.382;
C2= -53.508;
Psat1= 10^(A1-(B1/(T+C1)));
Psat2= 10^(A2-(B2/(T+C2)));
x= [0:0.05:1]
y= ((Psat1)*(x))/((x)*(Psat1)+(1.-x)*(Psat2))
plot(x,y,'r+')
----------------------------------------
I want to plot the relationship between x and y. Although y is an expression for x, this code holds y at one value. I want to know what is the problem, and how to change the code to operate it as I intended.

 采纳的回答

T= 323.15;
A1= 4.01814;
B1= 1203.835;
C1= -53.226;
A2= 4.08245;
B2= 1346.382;
C2= -53.508;
Psat1= 10^(A1-(B1/(T+C1)));
Psat2= 10^(A2-(B2/(T+C2)));
x= [0:0.05:1]
y= ((Psat1).*(x))./((x).*(Psat1)+(1.-x).*(Psat2))
plot(x,y,'r+')

5 个评论

use element-wise operation that is put .* and ./ instead of * and /
Wow, thank you for your help!
You are my hero!
Anytime :)
i did, can u help me with the solution please?I m new here, will knoe how to get started and make queries soon.
get back to your original question

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 MATLAB 的更多信息

产品

版本

R2018b

标签

Community Treasure Hunt

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

Start Hunting!

Translated by