function requires more input arguments to run
Afficher commentaires plus anciens
function [ dydt ]=a14(t,y)
mumax=0.5;
ks=1;
ki=3;
k=14;
i0=75;
a=0.014;
Yi=0.5;
kla=0.00095;
h=0.00316;
sgin=0.06;
%dydt=zeroes(size(y));
x=y(1);
sl=y(2);
sg=y(3);
i=i0/a*x*(1-exp(-a*x));
mu=mumax*sl/((sl+ks+sl^2/ki)*(i/i+k));
dydt(1)=mu*x;
dydt(2)=kla*((sg/h)-sl)- Yi*dydt(1);
dydt(3)=sgin-kla*((sg/h)-sl);
tspan=[0 9];
y0=[0.03 0 17];
[t,y]=ode45(@a14,tspan,y0);
subplot(2,2,1);
plot(t,y(:,2),'-',t,y(:,1),':',t,y(:,3));
legend('Sl','x','Sg','location','east','bold');
xlabel('time,d');
ylabel('conc.,g/L');
subplot(2,2,2);
plot(t,y(:,1),'-');
axis([0 10 0 1.2]);
xlabel('time,d');
ylabel('biomass,g/L');
subplot(2,2,3);
plot(t,y(:,2),'red');
axis([0 10 0 20]);
xlabel('time,d');
ylabel('Sl,g/L');
subplot(2,2,4);
plot(t,y(:,3),'-');
axis([0 10 0 20]);
xlabel('time,d');
ylabel('Sg,g/L');
tspan=[0 9];
y0=[0.03 0 17];
[t,y]=ode45(@a14,tspan,y0);
%hold off
end
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 7 Nov 2021
You forgot to show us the error! Here's another chance to read the posting guidelines:
Once you read that you'll learn you need to post ALL THE RED TEXT.
We have no idea what you passed in for t and y. For example, did you do this:
t = 10;
y = rand(5, 10);
[ dydt ]=a14(t,y)
Or did you not even define t and y and just clicked the green run triangle assuming MATLAB would somehow pick default values for t and y that would be acceptable for you? Because that won't happen.
6 commentaires
Sujay Bharadwaj
le 7 Nov 2021
Image Analyst
le 7 Nov 2021
Yes, you did what I said, and suspected : you "just clicked the green run triangle assuming MATLAB would somehow pick default values for t and y"
You need to define something for t and y like Jan and I said.
Sujay Bharadwaj
le 7 Nov 2021
Image Analyst
le 7 Nov 2021
So, get rid of 'bold' in your call to legend.
Sujay Bharadwaj
le 8 Nov 2021
Image Analyst
le 8 Nov 2021
y(:, 1) has a max of 0.03208 but you're setting the upper limit for the y axis to be 1.2. Change it to something smaller:
axis([0 10 0 0.04]);
Catégories
En savoir plus sur Language Fundamentals dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

