How to plot more than 3 lines on a graph?
7 次查看(过去 30 天)
显示 更早的评论
I can get R, G, R1 to show up on my graph, but when I add R2 it doesnt show up and all my graph labels disappear. Please help
figure
hold all
plot(T,R)
plot(T,G)
plot(T,R1)
plot(T,R2)
legend('R(T)','G(T)','Ta=250K','Ta=210K')
xlabel('Temperature (K)')
ylabel('G(T) and R(T) (cal/mol)')
title('G(T) and R(T) vs. T')
T = [310:1:450];
v = 1;
V = 10;
dHrxn = -80000;
UA = 3600;
kf0 = 1;
kc0 = 100;
T0 = 400;
ER = 20000;
CpA = 40;
kf = exp(-20000*(1./T-1/400));
kc = 100*exp((80000/1.987)*(1./T-1/400));
x = 1./(v./(V.*kf)+1+(1./kc));
R = 400*(T-310);
R1 = 400*(T-256);
R2 = 400*(T-220);
G = x*-dHrxn;
0 个评论
回答(1 个)
ag
2024-11-7,10:42
Hi Will,
The issue you are encountering arises from using the variables "T," "R," "G," "R1," and "R2" prior to their initialization.
Below is a revised version of your code, which addresses this matter:
T = [310:1:450];
v = 1;
V = 10;
dHrxn = -80000;
UA = 3600;
kf0 = 1;
kc0 = 100;
T0 = 400;
ER = 20000;
CpA = 40;
kf = exp(-20000*(1./T-1/400));
kc = 100*exp((80000/1.987)*(1./T-1/400));
x = 1./(v./(V.*kf)+1+(1./kc));
R = 400*(T-310);
R1 = 400*(T-256);
R2 = 400*(T-220);
G = x*-dHrxn;
figure
hold all
plot(T,R)
plot(T,G)
plot(T,R1)
plot(T,R2)
legend('R(T)','G(T)','Ta=250K','Ta=210K')
xlabel('Temperature (K)')
ylabel('G(T) and R(T) (cal/mol)')
title('G(T) and R(T) vs. T')
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!