Professional Documents
Culture Documents
MT311
Faculty of Engineering
Mechatronics Department
Lab2:
System Modeling
Eng Mohamed Doba
16 – 04 - 2018
Quiz-1
1- Solve the differential equation of the system using Matlab and plot its solution ?
𝑑𝑥 2
=𝑏 ∗ 𝑥 − 𝑝 ∗ 𝑥 b=1, P=0.5, x0=3
𝑑𝑡
2- Animation of 3d graph ?
Function: Z = sin(sqrt(X.^2+Y.^2))
System Modeling
System modeling using mathematical equations:
- System modeling using Differential equations. (Script)
- System modeling using Block diagrams. (Simulink)
- System modeling using Transfer function. (Script + Simulink)
System modeling using Simscape library in Matlab (Simulink)
System modeling using Experimental methods
System Modeling Using Mathematical Equations
(Example: Dc Motor)
Types of Dc Motors
Permanent magnet.
Electro magnet:
Separately excited.
Self excited:
- Shunt Dc motor.
- Series Dc motor.
- Compound Dc motor.
Dc Motors Modeling – Basic Equations
DC Motor Modeling - (If : Constant)
Dc Motor Modeling - (If : Constant)
- The back EMF of the motor is proportional to the angular velocity of the shaft by a
constant factor Ke.
Dc Motor Modeling - (If : Constant):
Equations describing the behavior
of the DC motor.
Output Variable.
Dc Motor Modeling - (If : Constant)
Example:
Using Matlab, solve the differential equation of the Dc motor? (i.e: current of the motor
with respect to time)
(v = 5 volts)
Dc Motor Modeling - (If : Constant)
Example:
Using Matlab, solve the differential equation of the Dc motor? (i.e: current of the motor
with respect to time)
(v = 5 volts)
Solution:
di = (vin-R*i-K*(K*i/b))/L;
end
More in Solving Differential Equations in Matlab
syms y(t)
eqn = diff(y, 2) == (1-y^2)*diff(y) - y
V = odeToVectorField(eqn)
More in Solving Differential Equations in Matlab
V is symbolic, but ode45 does not accept symbolic input. Therefore, convert V to a
MATLAB function by using matlabFunction. Specify the input variables as t and Y by
using the 'Vars' name-value pair argument.
M = matlabFunction(V,'Vars',{'t','Y'})
Solve the system defined by M using ode45 for 0 ≤ t ≤ 20. Use the initial conditions y(0) =
2 and y'(0) = 0.
tspan = [0 20];
y0 = [2 0];
[tspan,sol] = ode45(M,tspan,y0);
plot(tspan,sol)
More in Solving Differential Equations in Matlab
V = odeToVectorField(odes)
M = matlabFunction(V,'Vars',{'t','Y'})
tspan = [-5 5];
y0 = [1 0];
[tspan,sol] = ode45(M,tspan,y0);
plot(tspan,sol)
Dc Motor Modeling - (If : Constant)
Example:
Using Matlab, solve the differential equation of the Dc motor? (i.e: current of the motor
with respect to time)
(v = 5 volts)
vin = 5;R = 1;L = 0.5;
Solution:
K = 0.01;b = 0.1;j = 0.01;
odes = [ode1;ode2]
V = odeToVectorField(odes)
M = matlabFunction(V,'Vars',{'t','Y'})
tspan = [0 5];
y0 = [0 0];
[tspan,sol] = ode45(M,tspan,y0);
plot(tspan,sol)
DC Motor Modeling - (Series Dc motor)
DC Motor Modeling - (Series Dc motor)
Example:
Find the mathematical equations that describe the series dc motor and solve the
differential equations in Matlab?
Rs+Ra = 0.1
Vt = 5
K=k1=kf=0.1
Next lab:
https://www.mathworks.com/help/index.html
http://ctms.engin.umich.edu/CTMS/index.php
Any Questions ?!