MATLAB: How to fix graph with for loop

graphsloops

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?

Best Answer

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