Borrar filtros
Borrar filtros

How to fix graph with for loop

3 visualizaciones (últimos 30 días)
sophp
sophp el 31 de En. de 2018
Comentada: Star Strider el 31 de En. de 2018
I am trying to plot a graph to show me the operating curve of \tau with Y_B for different values of T. This is the code below:
t = 1:2:20;
T = 600:10:850;
for i=1:numel(T)
k1(i) = 1e7 .* exp(-12700 ./ T(i));
k2(i) = 5e4 .* exp(-10800 ./ T(i));
k3(i) = 7e7 .* exp(-15000 ./ T(i));
Y_B = (k1(i).*t.*(k1(i)+k3(i)))./(((k2(i).*t)+1).*(k1(i)+k3(i)).*(1+(t.*(k1(i)+k3(i)))));
plot(t, Y_B);
xlabel('Residence time, \tau / s')
ylabel('Yield of Maleic Anhydride ')
end
The graph produced is incorrect as it only has one operating curve. What is wrong with my code?

Respuesta aceptada

Birdman
Birdman el 31 de En. de 2018
Use hold on command:
t = 1:2:20;
T = 600:10:850;hold on;
for i=1:numel(T)
k1(i) = 1e7 .* exp(-12700 ./ T(i));
k2(i) = 5e4 .* exp(-10800 ./ T(i));
k3(i) = 7e7 .* exp(-15000 ./ T(i));
Y_B = (k1(i).*t.*(k1(i)+k3(i)))./(((k2(i).*t)+1).*(k1(i)+k3(i)).*(1+(t.*(k1(i)+k3(i)))));
plot(t, Y_B);
xlabel('Residence time, \tau / s')
ylabel('Yield of Maleic Anhydride ')
end

Más respuestas (0)

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