How to plot more than 3 lines on a graph?

7 visualizaciones (últimos 30 días)
Will Jeter
Will Jeter el 11 de Nov. de 2020
Respondida: ag el 7 de Nov. de 2024 a las 10:42
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;

Respuestas (1)

ag
ag el 7 de Nov. de 2024 a las 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!

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by