フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Matlab ode15s error: subscript indices must either be real positive integers or logicals.

1 回表示 (過去 30 日間)
Chinmay Sharma
Chinmay Sharma 2018 年 2 月 7 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello,
I have the following differential equation to be solved:
g1=0.988122979147950;
g2=0.644414268521746;
beta1=14.6523799554469;
beta2=-10.9849944881532;
beta3=411.648214174951;
g=227.598238564395;
n=1.56153644411635;
global spxdot;
shapeFunc=@(t,z)1-g1.*exp((-z.*abs(ppval(spxdot,t))/g2).^2).*ppval(spxdot,t).*(1-(beta1.*(sign(ppval(spxdot,t).*z)+beta2.*sign(ppval(spxdot,t)))+beta3.*sign(z)+ g).*(abs(z).^n));
trange=linspace(1,2401,2401)/1000;%converting to seconds
z0=0;%value of z at time t=0
[T,z1]=ode15s(shapeFunc,trange,z0);
But I am getting the following error:
Subscript indices must either be real positive integers or logicals.
Error in
differential>@(t,z)1-g1.*exp((-z.*abs(ppval(spxdot,t))/g2).^2).*ppval(spxdot,t).*(1-(beta1.*(sign(ppval(spxdot,t).*z)+beta2.*sign(ppval(spxdot,t)))+beta3.*sign(z)+g).*(abs(z).^n))
Error in odearguments (line 87)
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 differential (line 27)
[T,z1]=ode15s(shapeFunc,trange,z0);
Would somebody point out where I am doing the mistake? I double-checked the parens and operators but found nothing wrong.
Thanks,
  4 件のコメント
Torsten
Torsten 2018 年 2 月 7 日
編集済み: Torsten 2018 年 2 月 7 日
Yes.
See if you can really evaluate the structure:
t = 0.5;
result = ppval(spxdot,t)
Best wishes
Torsten.
Chinmay Sharma
Chinmay Sharma 2018 年 2 月 8 日
I figured it out. I made a very silly mistake.
I had another experiment data struct named 'exp' in the workspace while running the code. Matlab assumed exp to be a struct rather than a function. Once that was removed, it worked fine.
Thanks for the help, and sorry for the trouble!

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by