Error in sym/subref

2 visualizzazioni (ultimi 30 giorni)
Maria Ruiz
Maria Ruiz il 11 Nov 2021
Risposto: Walter Roberson il 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);

Risposte (1)

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

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Tag

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by