How to properly plot data points
Show older comments
Hi, I need to know the proper way I should plot my data such that I do not have to plot within the for loop, and so that the points will connect with a line.
clc
clear
SO = 8;
vm = 0.7;
ks = 2.5;
F =@(sm,t) SO-vm*t+ks*log(SO/sm)-sm;
sl = 0;
su = 9;
n = 6;
es = 0.5*10^(2-n);
for t = linspace(0,40,50)
sm = michaelis_menten(sl,su,es,t,F);
hold on;
plot(t,sm,'-');
hold off;
end
xlabel('Time(day)');
ylabel('Subtrate Concentration (moles/L)');
title('Substrate Concentration vs Time');
the function michaelis_menten is
function sm = michaelis_menten(sl,su,es,t,F)
ea = 1;
so = 1*10^8;
while ea > es
sm = (sl+su)/2;
if F(sl,t)*F(sm,t)< 0
su =sm;
elseif F(sl,t)*F(sm,t)>0
sl = sm;
else
so = sm;
end
ea = 100*abs((sm - so)/sm);
so = sm;
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!