How can I represent this state space in MATLAB Code?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
% 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
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.
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.
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.
I will try to do it by ode45. I am so grateful.
My pleasure
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Numeric Solvers에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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)
