フィルターのクリア

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

1 回表示 (過去 30 日間)
Dursman Mchabe
Dursman Mchabe 2019 年 1 月 9 日
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.

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by