Error in sym/subref

1 次查看(过去 30 天)
Maria Ruiz
Maria Ruiz 2021-11-11
%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);

回答(1 个)

Walter Roberson
Walter Roberson 2021-11-11
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)) ?

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by