Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Error with array elements

1 visualización (últimos 30 días)
Raquel Bautista
Raquel Bautista el 19 de Mzo. de 2020
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Index exceeds the number of array elements (1).
Can someone help me please? Got these errors
Error in odearguments (line 90) f0 = feval(ode,t0,y0,args{:});
% ODE15I sets args{1} to yp0.
Error in ode45 (line 115) odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
[~,y]=ode45(@Propuesta, tint, [Vo, X0, S0, Eo, ESo, 0]);
yyaxis(app.comportamiento, 'left')
plot(app.comportamiento, y(:,2),'g-', "LineWidth",5)
ylabel(app.comportamiento, 'Biomasa g.L^{-1})')
hold(app.comportamiento)
yyaxis(app.comportamiento, 'right')
plot(app.comportamiento, y(:,3),'r-', 'LineWidth',5)
plot(app.comportamiento, y(:,6),'m-','LineWidth',5)
ylabel(app.comportamiento, 'Sustrato & Producto g.L^{-1})')
xlabel(app.comportamiento, 'Tiempo (h)')
function dy=Propuesta(~,y)
V= y(1);
X= y(2);
S= y(3);
E= y(4);
ES= y(5);
P= y(6);
D=F/V;
miu=((miumax*S)/(ks+S))*(1-P/kp);
dV=D*V
dX=(miu-D-kd)*X;
dS=-((miu/Yxs)+ms)*X+D(Si-S)+(k_1*ES-k1*E*S)/V;
dE=((k_1+kp)*ES-(k1*E*S))/V;
dES=(k1*E*ES-(kp+k_1)*ES)/V-ES*D;
dP=((alpha*miu)+beta)*X-(D*P)+(kp*ES)/V;
dy= [dV;dX;dS;dE;dES;dP]
end

Respuestas (1)

Walter Roberson
Walter Roberson el 19 de Mzo. de 2020
function dy=Propuesta(~,y)
V= y(1);
X= y(2);
S= y(3);
E= y(4);
ES= y(5);
P= y(6);
Those variables are all scalars.
D=F/V;
where did F come from? What size is it? It seems most likely that it is a scalar, in which case D would be a scalar.
miu=((miumax*S)/(ks+S))*(1-P/kp);
Where did ks and kp come from? What size are they?
dS=-((miu/Yxs)+ms)*X+D(Si-S)+(k_1*ES-k1*E*S)/V;
Where did Si come from? And other variables in that expression?
And since S is one of the boundary condition, what reason would you have to expect that Si-S would be a non-negative integer such that the expression (Si-S) would be suitable for indexing variable D which seems most likely to be a scalar, but we can't be sure?
  2 comentarios
Raquel Bautista
Raquel Bautista el 19 de Mzo. de 2020
Yep, those are scalars. I put them with a slide on app designer
Walter Roberson
Walter Roberson el 19 de Mzo. de 2020
D(Si-S)
means that you want to calculate Si-S and use that as an index into D, but your D is a scalar.
Chances are that you forgot to put in a multiplication.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by