SlideShare a Scribd company logo
1 of 56
1
EG7102 Modelling, Simulation,
and Virtualization (15 credits)
Workshop 1: Dynamic
systems Modelling using
MATLAB/Simulink
Outline
1.What is Simulink?
2.Creating a simple program in MATLAB
3.Creating an equivalent program in SIMULINK
1. Creating a simple program to solve Algebra equations in MATLAB
Example: Find the value of q in the following equation.
(1)
(2)
(3)
Step 1: Create function for f(x)
Method 1: Creating functions and using MATLAB functions to find the value of q
Equation 1
Step 2: Create function for h(p,w)
Equation 2
Step 3: Call the functions f(x) & h(w,p) to find the value of q
Results
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
New Simulation model
SIMULINK Library
Method 1: Creating functions and using MATLAB codes to find the value of q
Finding the value of variable q using MATLAB/Simulink blocks
Finding the value of variable q using MATLAB/Simulink blocks
Finding the value of variable q using Matlab/Simulink with subsystem blocks
Subsystem 1
Subsystem 2
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
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
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
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
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
Model 1: using MATLAB/SIMULINK individual blocks
1. Create m file to define the model parameters (constants)
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
Model 2: using state-space model via MATLAB/SIMULINK
Let 𝑥1 = 𝜃
𝑥2 = 𝜃
A
Eq. 3
Eq. 4
B
C D
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
State-space model
Model 3: using transfer function model via MATLAB/SIMULINK
Take Laplase transform for both sides of Eq. 2
Eq. 2
𝜃 𝑡 =
1
𝑚𝐿2
𝑇 𝑡 −
𝑐
𝑚𝐿2
𝜃 𝑡 −
𝑔
𝐿
𝜃(𝑡)
L { }
𝑠2𝜽(𝑠 =
1
𝑚𝐿2
𝑻 𝑠 −
𝑐
𝑚𝐿2
𝑠𝜽(𝑠) −
𝑔
𝐿
𝜽(𝑠)
𝑠2
𝜽 𝑠 +
𝑐
𝑚𝐿2
𝑠𝜽 𝑠 +
𝑔
𝐿
𝜽(𝑠) =
1
𝑚𝐿2
𝑻 𝑠
𝒔2 +
𝑐
𝑚𝐿2
𝒔 +
𝑔
𝐿
𝜽(𝑠) =
1
𝑚𝐿2
𝑻(s)
… continue
T.F = G(s) =
𝑶𝒖𝒕𝒑𝒖𝒕
𝑰𝒏𝒑𝒖𝒕
For: 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
∴ G 𝒔 =
𝜽(𝒔)
𝑻(𝒔)
=
1/𝑚𝐿2
𝑠2 +
𝑐
𝑚𝐿2 𝑠 +
𝑔
𝐿
Eq. 5
G 𝒔 =
𝜽(𝒔)
𝑻(𝒔)
=
1
𝑠2 +
1
5
𝑠 + 10 Eq. 6
Transfer
function
• Model 3: using transfer function model via code in MATLAB
1.
• Model 3: using transfer function model using MATLAB/Simulink
1.
• Model 4: Nonlinear ODE (Eq. 1) using MATLAB/Simulink
1. Eq. 1
• Model 4: Nonlinear ODE (Eq. 1) using MATLAB/Simulink (i = 0 degree)
i = 0 degree
Increasing the damping, c=0.5
i = 0 degree
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
• 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
i = 45 degree
i
Double
click
t =10 sec
Nonlinear ODE
i = 45 degree
i = 90 degree
Damping
parameter, c= 0.5
i = 180 degree
Damping parameter, c= 0.2
Linearized model frailer
Increasing the rod length to 6 m = Increasing the settling time
Adding X-Y plotter block to plot theta versus thetaDot
Theta
Theta dot
Adding X-Y plotter block to plot theta versus thetaDot
3. Extract simulation results in the work space
Change name to y
Change save format to Array
Extract simulation results in the work space
Extract simulation results in the work space
Output data
Input data
Run simulation and plot the
results from the m file without
opening the simulation model
Linearisation
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.
• Linear State space model
• Nonlinear State space model
• The steady-state equations for the above system are
(2)
(1)
(2)
Jacobian matrix
State Space Linearization
(1)
2x1 cos(x2)
0 -3(x2)2
x1=1,x2=0
=
2 1
0 0
A = B =
0
1 C = [1 1], D = 0
;
;
Solution:
Example: Model 4 for the simple Pendulum Nonlinear using MATLAB/Simulink
1. Eq. 1
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
Linearization tool in Matlab
• Click on Step plot 1
• The steady-state model will
appear in the Linear Analysis
Workspace
• Double click on ‘linsys1’
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
Questions

More Related Content

Similar to Modelling using differnt metods in matlab2 (2) (2) (2) (4) (1) (1).pptx

Analysing simple pendulum using matlab
Analysing simple pendulum using matlabAnalysing simple pendulum using matlab
Analysing simple pendulum using matlabAkshay Mistri
 
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)Ravikiran A
 
Ece 415 control systems, fall 2021 computer project 1
Ece 415 control systems, fall 2021 computer project  1 Ece 415 control systems, fall 2021 computer project  1
Ece 415 control systems, fall 2021 computer project 1 ronak56
 
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/Theta
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/ThetaAlgorithm analysis basics - Seven Functions/Big-Oh/Omega/Theta
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/ThetaPriyanka Rana
 
control system Lab 01-introduction to transfer functions
control system Lab 01-introduction to transfer functionscontrol system Lab 01-introduction to transfer functions
control system Lab 01-introduction to transfer functionsnalan karunanayake
 
lecture 2 courseII (4).pptx
lecture 2 courseII (4).pptxlecture 2 courseII (4).pptx
lecture 2 courseII (4).pptxAYMENGOODKid
 
Gauss jordan and Guass elimination method
Gauss jordan and Guass elimination methodGauss jordan and Guass elimination method
Gauss jordan and Guass elimination methodMeet Nayak
 
Implementasi Pemodelan Sistem Ke TeeChart 2
Implementasi Pemodelan Sistem Ke TeeChart  2Implementasi Pemodelan Sistem Ke TeeChart  2
Implementasi Pemodelan Sistem Ke TeeChart 2Lusiana Diyan
 
Linear regression, costs & gradient descent
Linear regression, costs & gradient descentLinear regression, costs & gradient descent
Linear regression, costs & gradient descentRevanth Kumar
 
Lec03 04-time complexity
Lec03 04-time complexityLec03 04-time complexity
Lec03 04-time complexityAbbas Ali
 
Exercise 1a transfer functions - solutions
Exercise 1a   transfer functions - solutionsExercise 1a   transfer functions - solutions
Exercise 1a transfer functions - solutionswondimu wolde
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfRajJain516913
 
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudsko
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudskoCHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudsko
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudskoSydneyJaydeanKhanyil
 
Multinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache SparkMultinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache SparkDB Tsai
 
Alpine Spark Implementation - Technical
Alpine Spark Implementation - TechnicalAlpine Spark Implementation - Technical
Alpine Spark Implementation - Technicalalpinedatalabs
 

Similar to Modelling using differnt metods in matlab2 (2) (2) (2) (4) (1) (1).pptx (20)

Analysing simple pendulum using matlab
Analysing simple pendulum using matlabAnalysing simple pendulum using matlab
Analysing simple pendulum using matlab
 
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
DSP Lab Manual (10ECL57) - VTU Syllabus (KSSEM)
 
Ece 415 control systems, fall 2021 computer project 1
Ece 415 control systems, fall 2021 computer project  1 Ece 415 control systems, fall 2021 computer project  1
Ece 415 control systems, fall 2021 computer project 1
 
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/Theta
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/ThetaAlgorithm analysis basics - Seven Functions/Big-Oh/Omega/Theta
Algorithm analysis basics - Seven Functions/Big-Oh/Omega/Theta
 
control system Lab 01-introduction to transfer functions
control system Lab 01-introduction to transfer functionscontrol system Lab 01-introduction to transfer functions
control system Lab 01-introduction to transfer functions
 
lecture 2 courseII (4).pptx
lecture 2 courseII (4).pptxlecture 2 courseII (4).pptx
lecture 2 courseII (4).pptx
 
Gauss jordan and Guass elimination method
Gauss jordan and Guass elimination methodGauss jordan and Guass elimination method
Gauss jordan and Guass elimination method
 
Implementasi Pemodelan Sistem Ke TeeChart 2
Implementasi Pemodelan Sistem Ke TeeChart  2Implementasi Pemodelan Sistem Ke TeeChart  2
Implementasi Pemodelan Sistem Ke TeeChart 2
 
Linear regression, costs & gradient descent
Linear regression, costs & gradient descentLinear regression, costs & gradient descent
Linear regression, costs & gradient descent
 
Lec03 04-time complexity
Lec03 04-time complexityLec03 04-time complexity
Lec03 04-time complexity
 
04 Multi-layer Feedforward Networks
04 Multi-layer Feedforward Networks04 Multi-layer Feedforward Networks
04 Multi-layer Feedforward Networks
 
algorithm Unit 3
algorithm Unit 3algorithm Unit 3
algorithm Unit 3
 
Hprec7.1
Hprec7.1Hprec7.1
Hprec7.1
 
control_5.pptx
control_5.pptxcontrol_5.pptx
control_5.pptx
 
Exercise 1a transfer functions - solutions
Exercise 1a   transfer functions - solutionsExercise 1a   transfer functions - solutions
Exercise 1a transfer functions - solutions
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
 
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudsko
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudskoCHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudsko
CHAPTER 7.pdfdjdjdjdjdjdjdjsjsjddhhdudsko
 
parallel
parallelparallel
parallel
 
Multinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache SparkMultinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache Spark
 
Alpine Spark Implementation - Technical
Alpine Spark Implementation - TechnicalAlpine Spark Implementation - Technical
Alpine Spark Implementation - Technical
 

More from KadiriIbrahim2

Lecture 1 Introduction to robotics (1).pptx
Lecture 1 Introduction to robotics (1).pptxLecture 1 Introduction to robotics (1).pptx
Lecture 1 Introduction to robotics (1).pptxKadiriIbrahim2
 
session 2 Process modelling and dynamics (5).pptx
session 2 Process modelling and dynamics (5).pptxsession 2 Process modelling and dynamics (5).pptx
session 2 Process modelling and dynamics (5).pptxKadiriIbrahim2
 
Introduction to MultisimCircuitSimulation.pdf
Introduction to MultisimCircuitSimulation.pdfIntroduction to MultisimCircuitSimulation.pdf
Introduction to MultisimCircuitSimulation.pdfKadiriIbrahim2
 
components_of_hydraulic_and_pneumatic_system_-_part_1.pdf
components_of_hydraulic_and_pneumatic_system_-_part_1.pdfcomponents_of_hydraulic_and_pneumatic_system_-_part_1.pdf
components_of_hydraulic_and_pneumatic_system_-_part_1.pdfKadiriIbrahim2
 
Closed-loop control system modelling_pid.pptx
Closed-loop control system modelling_pid.pptxClosed-loop control system modelling_pid.pptx
Closed-loop control system modelling_pid.pptxKadiriIbrahim2
 
Introduction to module and IE.ppt
Introduction to module and IE.pptIntroduction to module and IE.ppt
Introduction to module and IE.pptKadiriIbrahim2
 
SKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdfSKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdfKadiriIbrahim2
 
ch6_digital_filters.pptx
ch6_digital_filters.pptxch6_digital_filters.pptx
ch6_digital_filters.pptxKadiriIbrahim2
 
Power_Point_PresentationTemplate_Mechanical_20.pptx
Power_Point_PresentationTemplate_Mechanical_20.pptxPower_Point_PresentationTemplate_Mechanical_20.pptx
Power_Point_PresentationTemplate_Mechanical_20.pptxKadiriIbrahim2
 
Fayomi Bassey Powerpoint seminar.pptx
Fayomi Bassey Powerpoint seminar.pptxFayomi Bassey Powerpoint seminar.pptx
Fayomi Bassey Powerpoint seminar.pptxKadiriIbrahim2
 

More from KadiriIbrahim2 (11)

Lecture 1 Introduction to robotics (1).pptx
Lecture 1 Introduction to robotics (1).pptxLecture 1 Introduction to robotics (1).pptx
Lecture 1 Introduction to robotics (1).pptx
 
session 2 Process modelling and dynamics (5).pptx
session 2 Process modelling and dynamics (5).pptxsession 2 Process modelling and dynamics (5).pptx
session 2 Process modelling and dynamics (5).pptx
 
Introduction to MultisimCircuitSimulation.pdf
Introduction to MultisimCircuitSimulation.pdfIntroduction to MultisimCircuitSimulation.pdf
Introduction to MultisimCircuitSimulation.pdf
 
components_of_hydraulic_and_pneumatic_system_-_part_1.pdf
components_of_hydraulic_and_pneumatic_system_-_part_1.pdfcomponents_of_hydraulic_and_pneumatic_system_-_part_1.pdf
components_of_hydraulic_and_pneumatic_system_-_part_1.pdf
 
Closed-loop control system modelling_pid.pptx
Closed-loop control system modelling_pid.pptxClosed-loop control system modelling_pid.pptx
Closed-loop control system modelling_pid.pptx
 
Introduction to module and IE.ppt
Introduction to module and IE.pptIntroduction to module and IE.ppt
Introduction to module and IE.ppt
 
SKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdfSKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdf
 
ch6_digital_filters.pptx
ch6_digital_filters.pptxch6_digital_filters.pptx
ch6_digital_filters.pptx
 
Power_Point_PresentationTemplate_Mechanical_20.pptx
Power_Point_PresentationTemplate_Mechanical_20.pptxPower_Point_PresentationTemplate_Mechanical_20.pptx
Power_Point_PresentationTemplate_Mechanical_20.pptx
 
Fayomi Bassey Powerpoint seminar.pptx
Fayomi Bassey Powerpoint seminar.pptxFayomi Bassey Powerpoint seminar.pptx
Fayomi Bassey Powerpoint seminar.pptx
 
Project Format.pptx
Project Format.pptxProject Format.pptx
Project Format.pptx
 

Recently uploaded

Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 

Recently uploaded (20)

Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 

Modelling using differnt metods in matlab2 (2) (2) (2) (4) (1) (1).pptx

  • 1. 1 EG7102 Modelling, Simulation, and Virtualization (15 credits) Workshop 1: Dynamic systems Modelling using MATLAB/Simulink
  • 2. Outline 1.What is Simulink? 2.Creating a simple program in MATLAB 3.Creating an equivalent program in SIMULINK
  • 3. 1. Creating a simple program to solve Algebra equations in MATLAB Example: Find the value of q in the following equation. (1) (2) (3)
  • 4. Step 1: Create function for f(x) Method 1: Creating functions and using MATLAB functions to find the value of q Equation 1
  • 5. Step 2: Create function for h(p,w) Equation 2
  • 6. Step 3: Call the functions f(x) & h(w,p) to find the value of q
  • 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
  • 9.
  • 10. New Simulation model SIMULINK Library Method 1: Creating functions and using MATLAB codes to find the value of q
  • 11. Finding the value of variable q using MATLAB/Simulink blocks
  • 12. Finding the value of variable q using MATLAB/Simulink blocks
  • 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
  • 24. Model 3: using transfer function model via MATLAB/SIMULINK Take Laplase transform for both sides of Eq. 2 Eq. 2 𝜃 𝑡 = 1 𝑚𝐿2 𝑇 𝑡 − 𝑐 𝑚𝐿2 𝜃 𝑡 − 𝑔 𝐿 𝜃(𝑡) L { } 𝑠2𝜽(𝑠 = 1 𝑚𝐿2 𝑻 𝑠 − 𝑐 𝑚𝐿2 𝑠𝜽(𝑠) − 𝑔 𝐿 𝜽(𝑠) 𝑠2 𝜽 𝑠 + 𝑐 𝑚𝐿2 𝑠𝜽 𝑠 + 𝑔 𝐿 𝜽(𝑠) = 1 𝑚𝐿2 𝑻 𝑠 𝒔2 + 𝑐 𝑚𝐿2 𝒔 + 𝑔 𝐿 𝜽(𝑠) = 1 𝑚𝐿2 𝑻(s) … continue
  • 25. T.F = G(s) = 𝑶𝒖𝒕𝒑𝒖𝒕 𝑰𝒏𝒑𝒖𝒕 For: 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 ∴ G 𝒔 = 𝜽(𝒔) 𝑻(𝒔) = 1/𝑚𝐿2 𝑠2 + 𝑐 𝑚𝐿2 𝑠 + 𝑔 𝐿 Eq. 5 G 𝒔 = 𝜽(𝒔) 𝑻(𝒔) = 1 𝑠2 + 1 5 𝑠 + 10 Eq. 6 Transfer function
  • 26. • Model 3: using transfer function model via code in MATLAB 1.
  • 27. • Model 3: using transfer function model using MATLAB/Simulink 1.
  • 28. • Model 4: Nonlinear ODE (Eq. 1) using MATLAB/Simulink 1. Eq. 1
  • 29. • Model 4: Nonlinear ODE (Eq. 1) using MATLAB/Simulink (i = 0 degree) i = 0 degree
  • 30. Increasing the damping, c=0.5 i = 0 degree
  • 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
  • 33. i = 45 degree i Double click
  • 34. t =10 sec Nonlinear ODE i = 45 degree
  • 35. i = 90 degree Damping parameter, c= 0.5
  • 36. i = 180 degree Damping parameter, c= 0.2 Linearized model frailer
  • 37. Increasing the rod length to 6 m = Increasing the settling time
  • 38. Adding X-Y plotter block to plot theta versus thetaDot
  • 39. Theta Theta dot Adding X-Y plotter block to plot theta versus thetaDot
  • 40.
  • 41. 3. Extract simulation results in the work space
  • 42. Change name to y Change save format to Array Extract simulation results in the work space
  • 43. Extract simulation results in the work space
  • 45. Run simulation and plot the results from the m file without opening the simulation model
  • 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)
  • 50. (2) Jacobian matrix State Space Linearization (1)
  • 51. 2x1 cos(x2) 0 -3(x2)2 x1=1,x2=0 = 2 1 0 0 A = B = 0 1 C = [1 1], D = 0 ; ; Solution:
  • 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