I want to solve the set of differential equations with external torques as additional parameters
function dx = myfun(t, x, tor1, tor2)
x[1] = ...;
x[2] = ...;
end
I understand that this can be done using anonymous functions with trailing parameters
[T, Y] = ode45(@(t,x) myfun(t, x, tor1, tor2), ts, x0);
Everything works fine when the torques, tor1 and tor2, are constants. However, I need my input torques to be a function of the system parameters x[1],x[2] etc. If I try to define my torques as a function I get the error "Inputs must be floats, namely single or double".
Also, since my torques are controlled by PID controllers, I also need the torques to be a function of the integrals of certain system parameters.
How can I go about doing this?

1 件のコメント

darova
darova 2019 年 11 月 10 日
編集済み: darova 2019 年 11 月 10 日
Use round brackets:
x(1) = ...;
x(2) = ...;
x = x'; % derivative vrctor should be vertical

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

回答 (0 件)

カテゴリ

製品

リリース

R2019b

タグ

質問済み:

2019 年 11 月 10 日

編集済み:

2019 年 11 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by