Filter löschen
Filter löschen

How can I increase the array elements of the optimization variable?

1 Ansicht (letzte 30 Tage)
Dursman Mchabe
Dursman Mchabe am 9 Jan. 2019
Hi all,
I am trying to run a dynamic optimization script, and I get the error message:
Index exceeds the number of array elements (1).
Error in myModel (line 3)
dxdt(1)= -2.85.*(1/((1/k(4))+(1/k(1))).*k(3).*x(2)*x(1).*(1-(k(2).*x(1))/(1+(k(2).*x(1)))));
Error in myObj>@(t,x)myModel(t,x,k) (line 24)
[t,x] = ode15s(@(t,x)myModel(t,x,k),time,x0);
Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode15s (line 150)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in myObj (line 24)
[t,x] = ode15s(@(t,x)myModel(t,x,k),time,x0);
Error in fminsearch (line 200)
fv(:,1) = funfcn(x,varargin{:});
Error in DynamicOptimization (line 3)
k = fminsearch('myObj',0.05);
On another code, I used:
sol = zeros(1,numel(t));
to resolve the error of:
Index exceeds the number of array elements (1).
In the attached example, I don't know how to do it.
Please help.

Antworten (0)

Kategorien

Mehr zu Problem-Based Optimization Setup finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by