poster
2019-12-10, 20:48
我已经有一段时间没有使用MATLAB了,所以我无法弄清楚我在做什么错。
我想绘制(在一张图上)4种不同温度的曲线。 V应该在x轴上, P应该在y轴上。
%之后的%内容只是对我的提醒,与我在情节中所做的无关。
这是我编辑器中的内容:
a=3.7E-7; b=4.3E-5; R=8.314E-6; n=1; V1_vector=zeros(1,25); P1_vector=zeros(1,25); T1=400; V1=.0000823; for n=1:1:25 P1=((R*T1)/(V1-b))-(a/(V1.^2)); V1_vector(n)=V1; P1_vector(n)=P1; V1=V1+.001324708; %V1=0.0332 n=n+1; end P1=P1_vector; V1=V1_vector; V2_vector=zeros(1,25); P2_vector=zeros(1,25); T2=350; V2=.00007133; for n=1:1:25 P2=((R*T2)/(V2-b))-(a/(V2.^2)); V2_vector(n)=V2; P2_vector(n)=P2; V2=V2+.0011579468; %V2=0.02902 n=n+1; end P2=P2_vector; V2=V2_vector; V3_vector=zeros(1,25); P3_vector=zeros(1,25); T3=300; V3=.00006347; for n=1:1:25 P3=((R*T3)/(V3-b))-(a/(V3.^2)); V3_vector(n)=V3; P3_vector(n)=P3; V3=V3+.0009906612; %V3=0.02483 n=n+1; end P3=P3_vector; V3=V3_vector; V4_vector=zeros(1,25); P4_vector=zeros(1,25); T4=250; V4=.0000577453; for n=1:1:25 P4=((R*T4)/(V4-b))-(a/(V4.^2)); V4_vector(n)=V4; P4_vector(n)=P4; V4=V4+.000825690188; %V4=0.0207 n=n+1; end P4=P4_vector; V4=V4_vector; PLOT(V1,P1,V2,P2,V3,P3,V4,P4) 这是错误消息
??? Attempt to execute SCRIPT Plot as a function: C:\Users\amy\Documents\MATLAB\Plot.m Error in ==> Plot at 73 PLOT(V1,P1,V2,P2,V3,P3,V4,P4) 请帮我!
回答:
如果要绘制点(V1, P1) , (V2, P2)等,请在绘制点之前将其放入向量中。尝试plot([V1, V2, V3, V4],[P1, P2, P3, P4]) 。
更多&回答... (https://stackoverflow.com/questions/3929071)
我想绘制(在一张图上)4种不同温度的曲线。 V应该在x轴上, P应该在y轴上。
%之后的%内容只是对我的提醒,与我在情节中所做的无关。
这是我编辑器中的内容:
a=3.7E-7; b=4.3E-5; R=8.314E-6; n=1; V1_vector=zeros(1,25); P1_vector=zeros(1,25); T1=400; V1=.0000823; for n=1:1:25 P1=((R*T1)/(V1-b))-(a/(V1.^2)); V1_vector(n)=V1; P1_vector(n)=P1; V1=V1+.001324708; %V1=0.0332 n=n+1; end P1=P1_vector; V1=V1_vector; V2_vector=zeros(1,25); P2_vector=zeros(1,25); T2=350; V2=.00007133; for n=1:1:25 P2=((R*T2)/(V2-b))-(a/(V2.^2)); V2_vector(n)=V2; P2_vector(n)=P2; V2=V2+.0011579468; %V2=0.02902 n=n+1; end P2=P2_vector; V2=V2_vector; V3_vector=zeros(1,25); P3_vector=zeros(1,25); T3=300; V3=.00006347; for n=1:1:25 P3=((R*T3)/(V3-b))-(a/(V3.^2)); V3_vector(n)=V3; P3_vector(n)=P3; V3=V3+.0009906612; %V3=0.02483 n=n+1; end P3=P3_vector; V3=V3_vector; V4_vector=zeros(1,25); P4_vector=zeros(1,25); T4=250; V4=.0000577453; for n=1:1:25 P4=((R*T4)/(V4-b))-(a/(V4.^2)); V4_vector(n)=V4; P4_vector(n)=P4; V4=V4+.000825690188; %V4=0.0207 n=n+1; end P4=P4_vector; V4=V4_vector; PLOT(V1,P1,V2,P2,V3,P3,V4,P4) 这是错误消息
??? Attempt to execute SCRIPT Plot as a function: C:\Users\amy\Documents\MATLAB\Plot.m Error in ==> Plot at 73 PLOT(V1,P1,V2,P2,V3,P3,V4,P4) 请帮我!
回答:
如果要绘制点(V1, P1) , (V2, P2)等,请在绘制点之前将其放入向量中。尝试plot([V1, V2, V3, V4],[P1, P2, P3, P4]) 。
更多&回答... (https://stackoverflow.com/questions/3929071)