MATLAB Answers

Solving nonlinear system of ode in Simulink

조회 수: 7(최근 30일)
Tom
Tom 2021년 9월 14일
댓글: Tom 2021년 9월 15일
I am trying to solve a system of nonlinear equations of motion in Simulink, where
x = [x1...x7] is the system state with the derivatives xdot = [x1dot...x7dot] and xdotdot = [x1dotdot...x7dotdot],
p = [p1...pn] are parameters (partly non constant) and
u = [u1...u3] is the system input.
All 7 equations are nonlinear, e.g.
p2*x2dotdot - p3*x3dotdot + p4*x4dotdot + p5*x4dot*x5dot - p6*x5 + p7 + u1 = 0;
As a result of this form, the second derivatives depend on another. This leads to a set of equations
x1dotdot = f1(p,u,x,xdot)
x2dotdot = f2(p,u,x,xdot,x3dotdot,x4dotdot,x5dotdot)
x3dotdot = f3(p,u,x,xdot,x2dotdot,x4dotdot,x5dotdot)
x4dotdot = f4(p,u,x,xdot,x2dotdot,x3dotdot,x5dotdot)
...
What I have tried so far is implementing the equations in a simulink model without changing their form. By adding unit delays I solved the equations based on the previous xdotdot.
Another way I tried was by solving the equations for x and xdot using the solve function to get a system of the form xdotdot = f(p,u,x,xdot). Based on this, I tried to change the system to a first order system by expanding x to [x, xdot].
However, all of these tries have lead to bad results (values getting very large + stepsize errors).
How should I go about solving these equations where the derivatives depend on another?

답변(1개)

Paul
Paul 2021년 9월 14일
The best way IMO is to get the equations in the form xdotdot = f(p,u,x,xdot), which you already did. But what did you mean by "expanding x to [x, xdot]."? Once you have the equations in the desired form, they are implemented using either two Integrator blocks in series to integrate from xdotdot to xdot and from xdot to x. The integrator outputs, xdot and x respectively, feed back into the calculation of xdotdot. Or, instead of two integrators, one can use an Integrator, Second Order block.
  댓글 수: 5
Tom
Tom 2021년 9월 15일
Thanks! I'll try this out and report my findings when I'm done

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

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by