You are on page 1of 9

ECE 411 – Computer Lab 1

Sekar Prasetya
09/07/23

Introduction
The purpose of the lab exercise is to familiarize oneself with MATLAB/Simulink. We
specifically want to get familiarized with Simulink for future laboratory exercises. Simulink is a
tool in MATLAB for analysis and simulation of dynamic systems. In this lab we will be running
an example provided by MATLAB and also building a gear drive system as shown by the lab
manual. The system will then go through different adjustments to better understand the
components and blocks of the system.

Results and Discussion

1. Running, Plotting, Printing: In order to achieve Figure 1 and Figure 2, the “Simulink”
button was selected and under the examples tab the “Aircraft Longitudinal Flight
Control” example was opened. Figure 2 was obtained by selecting the scope box near the
“Aircraft Dynamics Model” block.

Figure 1: Simulation Model of Aircraft Longitudinal Flight Control


Figure 2: Scope block output from Aircraft Longitudinal Flight Control

The scope gives one insight to see what happens before and after the system. It makes sense that
the square wave is slightly distorted because of the disturbance signal of wind and gust.

2. Model Building: The model in Figure 3 was created by searching items in the library that
Simulink provides. The pulse input is created with the first step having the final value of
4000 and the second step response having the final value of -4000 starting at the step time
of 4 seconds. This is set so that the scope block output would be the same as the example
given in the lab manual.

Figure 3: Simulink model of motor gear drive system


Figure 4: Simulink pulse input subsystem

Figure 5: Scope block output from simulation of motor gear drive system

i) Vary the Proportional gain up and down and note the effect.

What can be seen in the figures below is that when the proportional gain increases, the signal
oscillates more. When the proportional gain decreases then the signal oscillates less across the
step response.
Figure 6: Scope block output when simulation proportion gain equals 1

Figure 7: Scope block output when simulation proportion gain equal 0.005
ii) Now try adding in the Integral and/or Derivative gains. Plot a few of the results and discuss
how the different controller parameters (Proportional, Integral, and Derivative) affect the closed
loop performance.

Figures 8 and 9 are the scope outputs when the integral gain is adjusted. When the integral gain
is less than zero, there did not seem to be a difference but the output signal was less smooth due
to the integration. When the integral gain is increased to 1 then the signal is unrecognizable.

Figure 8: Scope block output when simulation integral gain equal 0.05

Figure 9: Scope block output when simulation integral gain 1


Figures 10 and 11 are the results when the derivative gain is adjusted. When the derivative gain
is adjusted to 0.05, the output signal looks more like the step signal that was imputed. When the
derivative gain was adjusted to 1, it also achieved a more step wave but with more oscillation
and inaccuracy near the start of the steps.

Figure 10: Scope block output when simulation derivative gain equal 0.05

Figure 11: Scope block output when simulation derivative gain equal 1
Overall, the proportional gain affects the oscillation of the wave, the derivative gain makes the
signal closer to the input signal, and the integral gain changes the type of step and smoothness of
the output curves.

iii) See if you can manually tune the PID controller to get a good step response.
I set all of the values of the PID to 0.05 and I got the signal to be close to the step response.

Figure 12: Scope block output when PID all set to 0.05

iv) See how well your controller rejects disturbances by adding a disturbance signal between the
controller and the plant (just use a summing junction to add your disturbance signal to the output
of the PID controller).

Figure 13: Simulink model of gear system with disturbance


Figure 14: Scope block output of simulation with disturbance signal

From the figures above, we can see that the controller does not do well with the disturbance
signal and it shifts the entire response above the step response.

v) See how sensitive your closed loop system is to modeling errors by perturbing the open loop
plant model (i.e., change the Transfer Function parameters)

Figure 15: Gear system block diagram with changed Transfer Function
Figure 16: Scope block output of simulation with changed transfer function

The closed loop system is also vulnerable to the change of the transfer function and overall the
system is very sensitive to disturbances and changes to the model.

Conclusion
This laboratory exercise provided me with ideas on how closed-loop control works and
the overall functions and usage of Simulink in MATLAB. It was interesting to see how different
parameters changed the response of the system and how the math behind it is crucial to create a
system that can adjust to both disturbance and changes in the system.

You might also like