Matlab Project 2
Matlab Project 2
MATLAB PROJECT
REPORT.
ALGORITHM & PROGRAMMING / M. NGONO
Name: WAFFO
Pronoun: Rudy Jardel
Matricula: 22P149
Filed: 3 GM
School: National Advanced School of Engineering
Course: Algorithm and Programming
Teacher: M. NGONO
1
MATLAB PROJECT REPORT.
INTRODUCTION
It’s been given to us the project that we have to solve, the objective of the project is to
Study the performance characteristics of first and second order system using the application we
call MATLAB to solve the project which is used to solve, analyze and design processes with a
programming language that expresses matrix and array mathematics directly. We use it here to get
the performance of first and second order systems, yet the performance of a system is what makes
it optimal for end use.
2
MATLAB PROJECT REPORT.
𝑑𝑉𝑐 (𝑡) 1 1
Equation of behavior: + 𝑉 (𝑡) = 𝐸 𝑤ℎ𝑒𝑟𝑒 𝑉𝑐 (0) = 𝑉0 𝑎𝑛𝑑 𝑅𝐶 = 𝜏
𝑑𝑡 𝑅𝐶 𝑐 𝑅𝐶
𝑉𝑐 (𝑡) 1
Transfer function: = 𝜏𝑠+1
𝐸(𝑠)
a. Let’s obtain the unit step response of the first order system with the given values of R &
C:
Below is the code of the two values of R and C in one program, and their step response
3
MATLAB PROJECT REPORT.
4
MATLAB PROJECT REPORT.
5
MATLAB PROJECT REPORT.
b. Let’s verify in each case that the calculated value of 𝜏 = 𝑅 ∗ 𝐶 and the one measured from the figure of 63% of the final value
are same:
when the equation line 𝑦 = 0.63 is drawn, it meeting point on the curve is projected on the 𝑥 = 20 for the first curve and 𝑥 = 7.5
for the second curve, which gives the point of intersection on the curve, the plot syntax inside the program allows us to get the
point of intersection.
6
MATLAB PROJECT REPORT.
7
MATLAB PROJECT REPORT.
8
MATLAB PROJECT REPORT.
𝑑2 𝑥(𝑡) 𝜕𝑥(𝑡)
The differential equation: 𝑀 +𝐵 + 𝐾𝑥(𝑡) = 𝐹(𝑡)
𝑑𝑡 2 𝜕𝑡
𝑂𝑢𝑡𝑝𝑢𝑡 𝐹(𝑠) 1
The transfer function: 𝑇𝐹 = = 𝑋(𝑠) = (𝑀𝑠2 +𝐵𝑠+𝐾)
𝐼𝑛𝑝𝑢𝑡
The generalized notation for a second order system with the step input applied: 𝑌(𝑠) =
2
𝜔𝑛
2)
𝑠(𝑠2 +2𝜁𝜔𝑛 𝑠+𝜔𝑛
𝑀𝑃 −𝑓𝑣
Overshoot: 𝑃. 𝑂 = ∗ 100%
𝑓𝑣
4
Settling time: 𝑇𝑠 = 𝜁𝜔
𝑛
Exercise 2:
𝑛𝜔2
We have: 𝑌(𝑠) = 𝑠(𝑠+2𝜁𝜔
𝑛)
Let’s find the step response of the system for values of 𝜔𝑛 and 𝜁 = 0.1, 0.4, 0.7, 1.0 & 2.0.
and let’s plot all the results in the same figure window and let’s fill the following table:
9
MATLAB PROJECT REPORT.
10
MATLAB PROJECT REPORT.
11
MATLAB PROJECT REPORT.
12
MATLAB PROJECT REPORT.
13
MATLAB PROJECT REPORT.
a. Let’s get the transfer function from R(s) to Y(s): the transfer function is on the command window
14
MATLAB PROJECT REPORT.
b. Let’s get the transfer function from D(s) to Y(s): the transfer function is on the command window
15
MATLAB PROJECT REPORT.
C. Let’s generate the system response of each value of k due to unit step input -r(t):
16
MATLAB PROJECT REPORT.
17
MATLAB PROJECT REPORT.
18
MATLAB PROJECT REPORT.
d. Let’s generate the system response due to a unit step disturbance -d(t):
19
MATLAB PROJECT REPORT.
20
MATLAB PROJECT REPORT.
21
MATLAB PROJECT REPORT.
22
MATLAB PROJECT REPORT.
Let’s code the program for each value of 𝐾𝑎 = [20 30 50 60 80], below is the MATLAB code:
23
MATLAB PROJECT REPORT.
24
MATLAB PROJECT REPORT.
We got the transfer function in the command window of the program above.
Ka 20 30 50 60 80
Overshoots 0 1.1758 7.6893 10.8433 16.2929
(%)
Settling 0.5835 0.3176 0.3790 0.3404 0.4038
time (s)
25
MATLAB PROJECT REPORT.
26
MATLAB PROJECT REPORT.
About the frequency response of the system, we notice that more we increase the value of Ka,
the more the frequency increases and the gain becomes more important.
The command to return step response characteristics is:
Thanks to the “ltiview (Hs)” command surrounded in the program above, run the code, a new
figure window opens, go to “Edit” at the menu bar, then click on “Plot Configurations”, and
select “Step” in the response type frame.
27
MATLAB PROJECT REPORT.
CONCLUSION
At the end of our project, we have studied the behavior of each system that has been given to us,
programmed and plotted the different response curves for first and second order systems and get
the different value of their characteristics, we have also plotted the bode diagram for the last
project to have the gain of the system depending of each value of Ka.
28