Borrar filtros
Borrar filtros

How do I modify the code to get a plot?

1 visualización (últimos 30 días)
YuChe Kao
YuChe Kao el 21 de Feb. de 2018
Comentada: YuChe Kao el 21 de Feb. de 2018
The program only run the result with a blank plot, how should I change my code to get a plot? My code is like this below
for t=0:0.05:5
T=170-22*t
if T>=120
G=(3.98*10^7)*exp(-6270/(8.314*(T-30)))*exp(-2.55*10^5/((T+273)*(200-T)))
else
G=(4.81*10^11)*exp(-6270/(8.314*(T-30)))*exp(-5.51*10^5/((T+273)*(200-T)))
end
plot(t,G);
axis([0,5,0,5]);
xlabel('Time');
ylabel('G')
end
Thank you a lot!!!

Respuesta aceptada

Birdman
Birdman el 21 de Feb. de 2018
t=0:0.05:5;
for i=1:numel(t)
T(i)=170-22*t(i);
if T(i)>=120
G(i)=(3.98*10^7)*exp(-6270/(8.314*(T(i)-30)))*exp(-2.55*10^5/((T(i)+273)*(200-T(i))));
else
G(i)=(4.81*10^11)*exp(-6270/(8.314*(T(i)-30)))*exp(-5.51*10^5/((T(i)+273)*(200-T(i))));
end
end
plot(t,G);
axis([0,5,0,5]);
xlabel('Time');
ylabel('G')

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots 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