






































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







































Class: 2 Date: 28 /06/
Topic: Solving Differential Equations in MATLAB/Simulink.
Software Required: MATLAB R2018a
Today we are going to solve the following problems:
Problem- 1. Use Simulink to solve the differential equation
ௗ௬
ௗ௧
Problem- 2. Solve the following differential equation using Simulink:
ௗ௬
ௗ௧
= - 10y+f( t ); where f( t )=2sin4 t and initial condition y(0)=
ௗ
మ
௬
ௗ௫
మ
ௗ௬
ௗ௧
Problem- 4. Simulate a simple RLC series circuit supplied with step input and study
the time response with the following parameters: R=1Ω, L=1mH, C= 100μF,
V=10V. Assume initial conditions to be zero.
Problem- 5. Obtain the dynamic response of a simple RC network by using the
Laplace Transformation Approach. The RC network is as follows:
Firstly, we will take a look on Differential Equation, Solver and Laplace
Transform briefly before solving the problem.
Introduction to differential equation
What is differential equation?
In mathematics, a differential equation is an equation that relates one or more
functions and their derivatives. In applications, the function generally represent
physical quantities, the derivatives represent their rates of change and the differential
equation defines a relationship between the two.
Choosing Solver:
Fixed Step Solver Variable-Step Solver
Next simulation time Current simulation time
plus step size
Current simulation time
plus step size
Step size Remain constant
throughout the simulation
Can vary from step to
step depending on the
model’s dynamics. The
step size reduces when
model’s states change
rapidly to maintain
accuracy
Suitability of application Suitable to run the model
on a real-time computer
system, because real-time
computer systems opera
at a fixed-size signal
sample rates
A variable solver may
cause the simulation to
miss error conditions that
can occur on a real-time
computer system.
Preferred when model’s
states change rapidly or
contain discontinuities to
reduce the simulation
time
The Laplace Transform
What is Laplace Transform?
The Laplace transform is most useful for solving linear, constant coefficient ode’s
when the inhomogeneous term or its derivative is discontinuous. Although ODE’s
with discontinuous inhomogeneous terms can also be solved by adopting already -
learned methods, we will see that the Laplace transform technique provides a
simpler, more elegant solution.
Definition and properties of the Forward and Inverse Laplace
transforms:
The main idea is to Laplace transform the constant coefficient differential equation
for x(t) into a simpler algebraic equation for the Laplace transformed function X(s),
solve this algebraic equation, and then transform X(s) back into x(t).
An exponential ansatz is used in solving homogeneous constant coefficient ODE’s
and the exponential function correspondingly plays a key role in defining the
Laplace transform. The Laplace transform of f(t), is denoted by F(s)=L{f(t)}, is
defined by the integral transform;
F(s)=∫ ݁
ି ௦௧
ஶ
ି ஶ
If L{f(t)} = F(s),
then the inverse Laplace transform of F(s) is ܮ
ି ଵ
{F(s)} = f(t)
Solving Differential Equations Using MATLAB/Simulink
ௗ௬
ௗ௧
=10sin t ; where, y(0)=
Solve:
Step-1: Open a new model and save it with a suitable name.
Step- 4 : Select ‘Sine Wave’
Step- 5 : Select ‘Gain’
Sine Wave
Gain
Step- 6 : Connect input port on each block as shown in the figure.
Step- 7 : Set the Integrator Parameters
Step- 7 : Set Simulation time properly.
Step- 8 : Run the circuit and observe the results.
Simulation Time
ௗ௬
ௗ௧
= - 10y+f( t ); where f( t )=2sin4 t and initial condition y(0)=
Solve:
Step-1: Select ‘Sine wave’
Sine Wave
Step-4: Select ‘Integrator’
Step-5: Select ‘Sum’
Integrator
Sum
Step-6: Connect the elements like this figure and run the simulation.
Step-7: Set the parameters of ‘Sum’.
Step-10: Set the parameters of ‘Gain’.
Step-11: Run the simulation and observe the result from scope.
ௗ
మ
௬
ௗ௫
మ
ௗ௬
ௗ௧
+5y=1; where y(0)=
Solve:
Step-1:
By rearranging this we get;
ௗ
మ
௬
ௗ௫
మ
ௗ௬
ௗ௧
Step-2: Select ‘Gain’
Gain
Step-4: Select ‘Constant’
Step-5: Select ‘Integrator’
Constant
Integrator
Step-6: Now connect the elements like this and run the simulation.
Step-7: Set parameters for ‘Constant’.