Vous êtes sur la page 1sur 4

Differential equations in Matlab/Simulink

I) Solve the following: dz(t)/dt=t*e –z, z(0)=-2


Note that t is a linearly increasing signal with slope 1.
I have written the exponential function in the block Matlab function.
The initial condition is written in the block Integrator.
In Figur Ib you can see the solution !

MAT LAB
Functi on
MAT LAB Fcn

Product 1
s
Ramp
Add Integrator Scope

Constant

Figure Ia

z(t)
4

-1

-2
0 1 2 3 4 5 6 7 8 9 10
tid

Figure Ib
II) Solve dz/dt=z2-z3+sin(t), z(0)=0.5
The differential equation in Simulink is implemented like Figure IIa.
The solution is shown in Figure IIb.

Product1

1
s
Integrator Scope
Product Add

Sine Wave

Figure IIa

z(t)
1.5

0.5

-0.5
0 1 2 3 4 5 6 7 8 9 10
tid

Figure IIb
III) Solve d2z(t)/dt2- dz(t)/dt+4z(t)=t*sin(t) , z(0)=1 , dz(0)/dt=-3
What kind of strategy to use ? I suggest that you eliminate everything on one side of
the equality sign except for the time differentiation of the highest order.
Then formulate the whole differential equation around the Add block.
The initial condition dz(0)/dt is inserted into the left integrator and
z(0) in the right. See the solution in Figure IIIb.

Sine Wave

1 1
Product s
s
Ramp z Scope
z_prim
Add

Gain

Figure IIIa

z(t)
250

200

150

100

50

-50

-100

-150
0 1 2 3 4 5 6 7 8 9 10
x

Figure IIIb
2 2 -0.1*cos(2t)
IV) Solve: d z(t)/dt - 2dz(t)/dt+10z(t)* dz(t)/dt =10*e
With initial conditions: z(0)=-1 , dz(0)/dt=1
Sine Wave can be changed to a cosine wave by a phase shift of 90o .
-0.1t
In the Matlab function we have written the following: 10*e .
The initial conditions are inserted into the integrators.
The condition dz(0)/dt is in the left integrator and z(0) in the right.
See the solution in Figure IVb !

Gain

1 1
s s
Add z_prim z Scope

10

Gain1 Product

MATLAB
Function Sine Wave
MATLAB Fcn

Figure IVa

z(t)
6

-1
0 1 2 3 4 5 6 7 8 9 10
tid

Figure IVb

Vous aimerez peut-être aussi