Numerical Solution for a system of Two Differential Equations

2 visualizaciones (últimos 30 días)
Suhaib Salah
Suhaib Salah el 6 de Nov. de 2021
Editada: Paul el 8 de Nov. de 2021
Dear,
I have a robotic system which has 2 outputs: 1- the position of a system. (X) 2- the tilt angel of the robot. (theta)
Following are the 2 equations, one for each output. The input is the voltage V. However, any other symbol is a constant.
We want to use ODE solvers. But we couldn't find an ODE example containing an input. Attached are the photos of the equation.
Your help is appreciated.
equation 1
equation 2
  1 comentario
Sam Chak
Sam Chak el 6 de Nov. de 2021
Editada: Sam Chak el 6 de Nov. de 2021
Generally, you need to design a feedback control law for the input voltage, V. But first, the ODEs have to rearranged so that the double-dot terms do not appear on the right-hand side of the equation. For example, the following system
can be decoupled to become
which can be expressed in the state space model
where is the input force.
For the general nonlinear system, .

Iniciar sesión para comentar.

Respuestas (1)

Paul
Paul el 6 de Nov. de 2021
Editada: Paul el 6 de Nov. de 2021
Because V(t) is an input presumably it can be expressed as a function of time, in which case the simplest appraoch is to just compute it inside odefun(). For example, suppose the differential equation to be solved is
dx/dt = -x(t) + V(t)
where V(t) = sin(t). Then the odefun is
function dxdt = odefun(t,x)
dxdt = -x + sin(t)
end
  2 comentarios
Suhaib Salah
Suhaib Salah el 8 de Nov. de 2021
Dear Paul,
Thanks.
We got rid of the input, credit goes to you. But what does remain? How to go on with our code? We have 2 outputs which is hard for me.
Your help will be appreciated.
Paul
Paul el 8 de Nov. de 2021
Editada: Paul el 8 de Nov. de 2021
Basically, you need to do what @Sam Chak was suggesting.
You have two second order differential equations:
xddot = f(thetaddot, thetadot, theta, xddot, xdot, x, V)
thetaddot = g(thetaddot, thetadot, theta, xddot, xdot, x, V)
The first step is to manipulate the equations inot the form
M*[xddot;thetaddot) = h(thetadot, theta, xdot, x, V)
where M is 2x2 and h is 2x1. The equations appear to be linear in the second derivatives, so it should be doable. The Symbolic Math Toolbox can help if don't want to do it by hand.
Next, define a state vector:
z1 = x
z2 = theta
z3 = xdot
z4 = thetadot
With these definitons, odefun would look something like this:
function dzdt = odefun(t,z)
V = % compute V(t) here
dzdt = zeros(4,1);
dzdt(1) = z(3);
dzdt(2) = z(4);
dzdt(3:4) = M\h(z4,z2,z3,z1,V); % assumes M is invertible
end
The state vector, z, is returned from the ode solver, like ode45() or ode23().

Iniciar sesión para comentar.

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by