How can I represent this state space in MATLAB Code?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
% Code
A=[ 0 1 0 0 ;
0 0 -7sin(0.05) 0;
0 0 0 1;
0 0 0 -38;];
B=[ 0 0 0 71]';
c=[1 0 0 0];
f=ss(A,B,C,D);
close loop=feedback(f,1)
Is this representation of the state space with sine in it is true ?
採用された回答
Les Beckham
2022 年 1 月 26 日
編集済み: Les Beckham
2022 年 1 月 26 日
You need to replace 7sin(0.05) with 7*sin(0.05).
Also, Matlab variable names can't have a space in them so close loop is not a valid variable name.
And your definition of C was in lower case.
And you didn't define D;
A = [ 0 1 0 0 ;
0 0 -7*sin(0.05) 0;
0 0 0 1;
0 0 0 -38;];
B = [0 0 0 71]';
C = [1 0 0 0];
D = 0; % Assuming no direct effect of the input on the output
f=ss(A,B,C,D);
closed_loop=feedback(f,1)
closed_loop =
A =
x1 x2 x3 x4
x1 0 1 0 0
x2 0 0 -0.3499 0
x3 0 0 0 1
x4 -71 0 0 -38
B =
u1
x1 0
x2 0
x3 0
x4 71
C =
x1 x2 x3 x4
y1 1 0 0 0
D =
u1
y1 0
Continuous-time state-space model.
8 件のコメント
taleem mat
2022 年 1 月 26 日
Thank you very much, I want to sure, is that mean there is no problem in write sine in state space because x2dot =-7sin(0.05x3)?
Les Beckham
2022 年 1 月 26 日
編集済み: Les Beckham
2022 年 1 月 26 日
Yes, -7*sin(0.05) is just a number, so it is perfectly valid as an element of a numeric matrix which is all that the A matrix in a linear time invariant state space model is.
-7*sin(0.05)
ans = -0.3499
Now, if you expect, as I think you are implying in this comment, x2dot to be -7*sin(0.05*x3), that is a different thing entirely. You can't express that non-linear relationship in a linear time invariant statespace model, xdot = A*x + B*u where A and B are constant numeric matrices of appropriate size, and x and u are the state vector and input vector, respectively.
You could simulate such a non-linear model in Simulink, however.
taleem mat
2022 年 1 月 26 日
Ok, thank you very much
Les Beckham
2022 年 1 月 26 日
編集済み: Les Beckham
2022 年 1 月 26 日
You are welcome.
I just noticed the .png file attached to your question. Was that always there?
Are you sure that is the correct model? I don't see the input u anywhere and x4 is repeated in your equation for x4dot. Is that supposed to be x4dot = -38*x4 + 71*u perhaps? That would be consistent with your B matrix.
taleem mat
2022 年 1 月 27 日
Yes, sir. I made a mistake. X4dot==-38*x4+71*u. I still have problems. I must represent this system in Matlab code, not in Simulink, but I have no idea. How can I do that? Please, could you give me any ideas?
Les Beckham
2022 年 1 月 27 日
編集済み: Les Beckham
2022 年 1 月 27 日
Look at the "Solve Nonstiff Equation" example on that doc page.
Also try Googling for "matlab ode45 system of equations" to find some examples in Matlab Answers of solving systems of equations using ode45.
taleem mat
2022 年 1 月 27 日
I will try to do it by ode45. I am so grateful.
Les Beckham
2022 年 1 月 27 日
My pleasure
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
タグ
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
