フィルターのクリア

Integrator does not accept input

2 ビュー (過去 30 日間)
Andrei Rotaru
Andrei Rotaru 2024 年 6 月 23 日
コメント済み: Sam Chak 2024 年 6 月 24 日
Hello, I'm trying make a model in simulink of an inverted pendulum and I can't simulate the space state. It's still telling me about that the integrator does not accept the input. Does anyone know what do to in this situation?
The formula that I'm trying to simulate:
Simulation:
The error:
Matlab code:
%%Parameters
Mp = 0.272;
dM = 0.071;
g = 9.81;
J = 0.002;
Jw = 3.941*10^-5;
b_theta = 0.82*10^-3;
b_altha_kmke_Ra = 1.202*10^-4;
km_Ra = 1.837*10^-4;
%%Matrice
A = [0 1 0 0;
(Mp*dM*g)/J -(b_theta)/J 0 1/J*b_altha_kmke_Ra;
0 0 0 1;
-(Mp*g*dM)/J b_theta/J 0 -(J+Jw)/(J*Jw)*b_altha_kmke_Ra];
B = [0 0;
-1/J*km_Ra 1/J;
0 0;
(J+Jw)/(J*Jw)*km_Ra -1/J]
C = [1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 0];
D = [0 0; 0 0;0 0;0 0];
%%Build system
sys = ss(A,B,C,D);
x0 = [5*pi/180;0;0;0]; %initial condition for the integrator

採用された回答

Sam Chak
Sam Chak 2024 年 6 月 24 日
The error is caused the mismatched matrix dimension. Do the following as shown in the graphics below should fix the issue. However, the built-in State-Space block can also perform the job equally.
  2 件のコメント
Andrei Rotaru
Andrei Rotaru 2024 年 6 月 24 日
Hi! Thanks a lot! It was very helpfull!
I need to do it manualy because I need the term x. And I don't know if i can extract it from the state space block individually.
Sam Chak
Sam Chak 2024 年 6 月 24 日
If you wish to extract the state variables x, then only the state matrix equations is necessary. First, the output and direct matrices must be constructed as shown below. Then, the individual state variables can be extracted using the "Demux" block.
A = [zeros(3, 1), eye(3); zeros(1, 4)]
A = 4x4
0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
B = [0; 0; 0; 1]
B = 4x1
0 0 0 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
C = eye(size(A))
C = 4x4
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
D = 0*eye(size(A))*B
D = 4x1
0 0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by