Is there a block in Simulink to load equations in state variables ?

3 ビュー (過去 30 日間)
Roberto Carabajal
Roberto Carabajal 2021 年 9 月 7 日
コメント済み: Paul 2021 年 9 月 10 日
I remember having seen some time ago a custom block in Simulink, that allowed to place a system of equations written in the format of state variables (in several lines). I haven't found it again and I don't see it in the repositories. I would be very grateful if someone could tell me about it.
My best regards.

回答 (3 件)

Paul
Paul 2021 年 9 月 7 日
This one?
  1 件のコメント
Paul
Paul 2021 年 9 月 10 日
One can enter user defined differential equations in a Matlab Function block. The body of the function would look like:
function xdot = pendulum(x)
g = -9.81;
L = 1;
xdot(1) = x(2);
xdot(2) = -g/L*sin(x(1));
end
Mabe this is what you're looking for?
In any case, if you respond to this comment, please don't start a new answer. Instead, just type your response in the area underneath this comment that says in light gray "Comment on this answer ..."

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


Roberto Carabajal
Roberto Carabajal 2021 年 9 月 8 日
No, it was something like
x(1)= .........
x(2)= .......
x(3)= ........
where x(n) means derivative of x(n-1)
x(1) means x dot.
Each x() is placed in one line in the box
  1 件のコメント
Paul
Paul 2021 年 9 月 9 日
編集済み: Paul 2021 年 9 月 9 日
Now I'm confused about what the equations are that need to be implemented. Can you write a few lines of Matlab code that illustrates an example set of equations?

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


Roberto Carabajal
Roberto Carabajal 2021 年 9 月 9 日
Suppose the sinple pendulum differential equation:
ẋ1=x2
ẋ2= -g/l*sin(x1)

カテゴリ

Help Center および File ExchangeGeneral Applications についてさらに検索

製品


リリース

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by