Error in sym/subref

1 Ansicht (letzte 30 Tage)
Maria Ruiz
Maria Ruiz am 11 Nov. 2021
Beantwortet: Walter Roberson am 11 Nov. 2021
%Indicate variables
x0 =1.25;
S0 =86.63;
P0 =0;
Kd = 0.0032;
a = 0.6212;
Yps = 0.5820;
Ki = 243.95;
c = 0.5557;
Ks = 0.0191;
d = 30.7600;
syms t S
mu = ((c*S)/Ks+S+(S^2/Ki))*(1-(-Yps*S+Yps*S0+P0/d));
m1 = exp(int(mu,0,t));
m2 = (-a*c/Yps)*((S+Yps*S^2-Yps*S*S0-P0*S)/Ks+S+(S^2/Ki));
%% 1st method ODE
x=linspace(0,0.5,50);
h=0.5;
f1= 86.63;
for i = 1:length(x)
f(i+1) = f(i) + h*(m1(i)*m2(i));
end
Index exceeds the number of array elements (1).
Error in sym/subsref (line 900)
R_tilde = builtin('subsref',L_tilde,Idx);

Antworten (1)

Walter Roberson
Walter Roberson am 11 Nov. 2021
m1 and m2 are scalar symbolic expressions that do not involve x.
They do involve S. perhaps you want to subs(m1, S, x(i)) ?

Tags

Produkte


Version

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by