I have attached two .m files. One is the code to solve an multiple DoF equation using state space representation and other is the state space equation.
I'm getting the following errors:
Error using state_space
Too many input arguments.
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);
Error in Exc4_1 (line 27)
[tsim, wsim] = ode45(@state_space,time,w0,'options',mass,inertia,stiffness_f, stiffness_r, damping_f, damping_r, l_f, l_r);
How can I correct the code?

 採用された回答

Walter Roberson
Walter Roberson 2020 年 4 月 27 日

0 投票

Do not attempt to use the obsolete syntax for adding extra variables to a function. Instead see http://www.mathworks.com/help/matlab/math/parameterizing-functions.html

2 件のコメント

Varun Vijaykumar Vupparige
Varun Vijaykumar Vupparige 2020 年 4 月 27 日
Hey Walter
Could you please elaborate on this? I did not get my mistake.
Ameer Hamza
Ameer Hamza 2020 年 4 月 27 日
You are using a syntax of ode45, which has been obsolete for ages now. Even the archived documentation back to 2013a does not mention this syntax.
You can continue working with your current syntax of ode45, and change the function signature like this.
function dw = state_space(t,w,mass,inertia,stiffness_f,stiffness_r,damping_f,damping_r,l_f,l_r)
%^ add t here
However, as Walter recommended, you should switch to the new syntax. For that, leave the function signature unchanged but call the ode45 like this
[tsim, wsim] = ode45(@(t,w) state_space(w,mass,inertia,stiffness_f,stiffness_r,damping_f,damping_r,l_f,l_r),time,w0);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeNumerical Integration and Differential Equations についてさらに検索

製品

リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by