8. We can acssess to Simulink by two ways
1. type Simulink in the workspace
2. Click the Simulink icon in the upper bar
Method 2: Using MATLAB/Simulink to find the value of q
13. Finding the value of variable q using Matlab/Simulink with subsystem blocks
Subsystem 1
Subsystem 2
14. 1. Develop a differential equation describing the dynamics
of a nonlinear system.
2. Investigate various methods in Simulink to solve these
systems (individual blocks, state space, and transfer
functions).
3. Simulate the response of these systems to inputs and
initial conditions.
4. Modify the system to include nonlinear dynamics.
2. Solving ODEs using MATLAB/SIMULINK toolbox
15. Example: Equations of motion: The simple Pendulum
The ODE describes the dynamic response
2n-order system
Nonlinear because we have sin()
J 𝜃 𝑡 = 𝑇 𝑡 − 𝑚𝑔𝐿 sin 𝜃 𝑡 − 𝑐𝜃 𝑡
𝜃 𝑡 =
1
𝐽
𝑇 𝑡 −
𝑚𝑔𝐿
𝐽
sin 𝜃 𝑡 −
𝑐
𝐽
𝜃 𝑡
Re-arrange the above equation:
𝐽 = 𝑚𝐿2
Recall
𝜃 𝑡 =
1
𝑚𝐿2
𝑇 𝑡 −
𝑔
𝐿
sin(𝜃 𝑡 ) −
𝑐
𝑚𝐿2
𝜃(𝑡) Eq. 1
16. The ODE describes the dynamic response of the Pendulum
For initial condition = 0o
we can approximate the above nonlinear ODE to
linear (Eq. 2) because Sin() = 0 =
Eq. 1
Eq. 2
𝜃 𝑡 =
1
𝑚𝐿2
𝑇 𝑡 −
𝑔
𝐿
𝜃 𝑡 −
𝑐
𝑚𝐿2
𝜃(𝑡)
𝜃 𝑡 =
1
𝑚𝐿2
𝑇 𝑡 −
𝑔
𝐿
sin(𝜃 𝑡 ) −
𝑐
𝑚𝐿2
𝜃(𝑡)
The new model will be linear
The nonlinear model
17. Assume the values of the system parameters (constants) as given below;
g = 10 m/s2
m = 1 kg
c = 0.2 Nm/rad/sec
L = 1m
1/mL2 = 1;
g/L =10;
c/mL2 = 1/5
Eq. 1
Eq. 2
Nonlinear for any value
of initial
Linear when initial = 0o
18. The simple pendulum model (final)
Pendulum
Model
Input
T, Torque Output
, the deflection
angle
g = 10 m/s2
m = 1 kg
c = 0.2 Nm/rad/sec
L = 1m
T(t ), (t) : Model variables
Model
parameters
19. Model 1: using MATLAB/SIMULINK individual blocks
1. Create m file to define the model parameters (constants)
20. 2. Run the previous m file to generate the model parameters in the workspace
3. Build the Simulink model as shown below and you should get the shown results
21. Model 2: using state-space model via MATLAB/SIMULINK
Let 𝑥1 = 𝜃
𝑥2 = 𝜃
A
Eq. 3
Eq. 4
B
C D
22. Method 2: using state-space model via MATLAB/SIMULINK
A B
C D
g = 10 m/s2; m = 1 kg; c = 0.2 Nm/rad/sec;
L = 1m
Substituting the parameters values in Eq 3 and 4 yields
Eq. 3
Eg. 4
31. T(t)
Unit Step function at t=5 sec, T(t)= 1
(t) step response using four models
for initial condition i = 0 degree
Increasing the
damping, c = 0.5
32. • Model 4: Nonlinear ODE (Eq. 1) using MATLAB/Simulink (i = 0 degree)
i = 45 degree
https://upload.wikimedia.org/wikipedia/commons/c/c1/Pendu
lum_45deg.gif
47. Linearization Example
• example, suppose that the nonlinear function is: y
= x2.
• Linearizing this nonlinear function about the
operating point x = a = 1, y = 1 results in a
linear function
L(y) = y(a) + y’(a) *(x-a)
= 1 + 2x *(x-1) =2x −1.
• The shown figure shows a possible region of good
approximation for the linearization of y=x2. The
actual region of validity depends on the nonlinear
model.
48.
49. • Linear State space model
• Nonlinear State space model
• The steady-state equations for the above system are
(2)
(1)
52. Example: Model 4 for the simple Pendulum Nonlinear using MATLAB/Simulink
1. Eq. 1
53. Linearization tool in Matlab
Compute Open-Loop Response Using Model Linearizer
1.Open the Linearization tab. To do so, in the Apps gallery,
click Linearization Manager.
2. To specify an analysis point for a signal, click the signal in the
model. Then, on the Linearization tab, in the Insert Analysis
Points gallery, select the type of analysis point.
3. Configure the input signal of the input of the block as an Input
Perturbation.
4. Configure the output signal of the output of the block
5. System block as an Open-loop Output.
Annotations appear in the model indicating which signals are
designated as analysis points. T
theta
54. Linearization tool in Matlab
• Click on Step plot 1
• The steady-state model will
appear in the Linear Analysis
Workspace
• Double click on ‘linsys1’
55. 1. Equations of motion for an example dynamic system
2. Implementing linear ODE
a) Individual blocks
b) State space
c) Transfer function
3. Simulating response of the system
a) inputs
b) Intial condition
c) Run the simulation model from the m.file
d) Extracting and plotting the simulation results from the m.file
Summery