Beruflich Dokumente
Kultur Dokumente
KE26503
Assignment 2
1415(1) Assignment #2
MATLAB m-file
For example, in order to solve the second order equation:
d2y/dt2 + 3dy/dt + 2y = cos2t with y(0) = 0 and dy/dt t=0 = 1
for 0 t 10 we must define a variable x such that:
x = dy/dt
Thus we can rewrite the differential equation as:
d2y/dt2 = 3dy/dt 2y + cos2t
or in terms of x: dx/dt = 3x 2y + cos2t
KE00103 / KS20303
Test #2
Differential Equations
0910(2)
We will use the ode45 command to solve the system of first order
differential equations:
dx/dt = 3x 2y + cos2t
dy/dt = x
We place these two equations into a column vector, z, where:
z=
x
y
dz /dt = dx / dt
dy /dt
MATLAB-SIMULINK
The second order differential equation, d 2y/dt 2 + 3dy/dt + 2y = cos2t in
Simulink. This equation can be re-written as, d 2y/dt 2 = 3dy/dt 2y +
cos2t. In order to get the three input subtractor, use the two input
subtractor.In order to get y and dy/dt we need to integrate the output of
this summer twice. Simulate the circuit for 10 seconds
KE00103 / KS20303
Test #2
Differential Equations
0910(2)