필터 지우기
필터 지우기

Using ode45 to solve matrix/vector form of state space diff eq

조회 수: 1 (최근 30일)
Reed Garion Williams
Reed Garion Williams 2018년 3월 14일
편집: James Tursa 2018년 8월 2일
I currently have two state space equations in matrix/vector form
The first is Ydot4=[a 0 0 0;0 0 0 0; 0 0 b 0;0 0 0 0 c]*[y1;y2;y3;y4]
The second is Ydot2= [d 0 0 0;0 e 0 0;0 0 f 0;0 0 0 g]*[y1;y2;y3;y4]+[h 0 0 0]*V0(t)
I would like to know how to solve these equations using ODE45 over a timespan of 0 to 1 seconds with intervals of 1ms. And V0(t)=5cos(40t)
Ydot4=V2doubledot
Y4=V2dot
Y3=V2
Y2=V1dot
Ydot2=V1doubledot
Y1=V1 .
  댓글 수: 7
Reed Garion Williams
Reed Garion Williams 2018년 3월 14일
How will someone answer the question if it is closed???
Birdman
Birdman 2018년 3월 14일
By the time I was closing this, you also closed your initial question as well. Keep this question here and eventually someone will answer.

댓글을 달려면 로그인하십시오.

답변 (2개)

James Tursa
James Tursa 2018년 3월 14일
편집: James Tursa 2018년 3월 14일
Trying to understand your nomenclature, and using your element ordering, here is the layout I would normally start with for a 4-element state vector y:
y(1) = Y1 = V1
y(2) = Y2 = V1DOT = d(V1)/dt = d(Y1)/dt
y(3) = Y3 = V2
y(4) = Y4 = V2DOT = d(V2)/dt = d(Y3)/dt
This is not the way I would have done it, btw. I would usually prefer to keep all of the "position" elements next to each other and then all of the "velocity" elements next to each other, rather than interleaving them as you have done. But, continuing with your element ordering, the derivatives would be:
d(y(1))/dt = d(Y1)/dt = d(V1)/dt = y(2)
d(y(2))/dt = d(Y2)/dt = d(V1DOT)/dt = d^2(V1)/dt^2 = V1doubledot
d(y(3))/dt = d(Y3)/dt = d(V2)/dt = y(4)
d(y(4))/dt = d(Y4)/dt = d(V2DOT)/dt = d^2(V2)/dt^2 = V2doubledot
So the first and third element derivatives are easy of course. For the second and fourth derivative elements, that would be obtained from your state space equations in vector form.
But at this point I am confused. Your Ydot4 state space matrix equation seems to map the [y1;y2;y3;y4] back to V2 (as a vector and not as an element), but then your Ydot2 state space matrix equation seems to map [y1;y2;y3;y4] back to V1 (again as a vector and not as an element). So they seem to map to two different variables, and those variables seem to be vectors? Which leads me to believe that all the stuff I just wrote is not valid and doesn't really apply to your problem.
Can you clarify what the variables in your system are, what their dimensions are, and what the derivative equations for these variables are? Your current nomenclature is hard for me to follow.

Bilal sadiq
Bilal sadiq 2018년 8월 2일
편집: James Tursa 2018년 8월 2일
Reed Garion Williams can you provide matlab script or some further explanation so that one can better understand to help you....

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by