# ECE 486 Control Systems Lab (Fall 2017)

 Day 1 Day 2 Day 3 Day 4 Short labs, weekly Day 5 Day 6 Day 8 Long labs, biweekly Day 7 Day 9 Day 10 Day 11 Final project, weekly

## Lab 2 – Digital Simulation

Day 3 of ECE 486 Lab. We will go through Lab 2 of lab manual and study the effect of adding extra zero and pole to an existing second order transfer function.

### Maths Behind the Scenes

Recall the second order transfer function we studied last time

$H_1(s) := \frac{Y_1(s)}{U(s)} = \frac{\omega^2_n}{s^2 + 2 \zeta \omega_n s + \omega^2_n},$

where $\zeta$ is the damping ratio and $\omega_n$ is the natural frequency.

#### Extra Zero

We can introduce an extra zero to the existing transfer function $H_1(s)$ by multiplying $(1 + \frac{s}{\alpha \zeta})$, i.e., the new transfer function $H_2(s)$ looks like

$H_2(s) := \frac{Y_2(s)}{U(s)} = \frac{\omega^2_n (1 + \frac{s}{\alpha \zeta})}{s^2 + 2 \zeta \omega_n s + \omega^2_n}.$

By $H_2(s) = H_1(s) (1 + \frac{s}{\alpha \zeta})$, we can cancel $U(s)$ on both sides. What is the relationship between $Y_2(s)$ and $Y_1(s)$. Further how to interpret this relationship in frequency domain in terms of a corresponding relationship in time domain?

#### Extra pole

Similar to how we introduced an extra zero, we divide $H_1(s)$ by $(1 + \frac{s}{\alpha \zeta})$ to introduce an extra pole.

$H_3(s) := \frac{Y_3(s)}{U(s)} = \frac{\omega^2_n}{(1 + \frac{s}{\alpha \zeta})(s^2 + 2 \zeta \omega_n s + \omega^2_n)}.$

### Matlab Part

Keep the header/preamble of your script from Lab 0. (Include those lines as part of your matlab script template.)

% ...

%% preamble
% lab 2 - digital simulation
% by me and partner
% today's date

%%
clear     % clear values of (all) variables in workspace
clc       % clear messages in the command window
clf       % clear existing figures
close all % close all existing windows; w/o 'all', only close the latest

% ...

%% run simulations in part ii
% note: to get original response y1 using alpha = inf in diagram for y2's

% case a:  alpha = ...

% ...

sim('lab2part2') % run simulation without using click button

% ...

% case e:  alpha = ...

% case y1: alpha = inf;

% ...

% note: you can also use an array for all six different alpha's and loop
% over different values

%% run simulations in part iii
% note: to get original response y1, you cannot use alpha = inf; instead
% pull y1 directly from where it is in the diagram (it is always available)

% case a: alpha = ...

% ...

% case c: alpha = ...

% unstable case, try it but not overlay its response with stable cases, b/c
% unstable response blows up and it diminishes stable responses

% case d: alpha = ...

%% plot data

% figure for part ii
figure(1)
plot(tout2a, y2a, 'r-')
hold on
plot(tout2b, y2b, 'b--')
% ...

% figure for part iii
figure(2)
% ...


Visualize data using plot().

Always clean up before exiting. Specifically,

• Clean up bench table, restore pot, motor lock etc, reinstall screws;
• Sort out wires color by color, type by type and put them back to racks;
• Turn off oscilloscope, meters etc;
• Restore chairs.

## Follow-up

• It is a good idea to get started on prelab 31 now. For prelab 3, there is a template (not so great but usable, please include all your work for full credit in prelab 3), you can grab it from our course website. There might be hints on some questions of prelab 3 in that template.
• For the last part of lab 2 report, I did an intermediate step for you. I used Maple® and Mathematica® to do “partial fraction expansion” and the result is attached in the pdf’s; you can go to

and grab either of the two files under folder notes,

H3DecomposeMaple.pdf, H3DecomposeMathematica.pdf.

The remaining work for you is to compare the coefficients and do the correct analysis following the hint in your lab manual and lab 2 report template.2

• We have seen in the third part of lab 2 that a first order transfer function $\frac{1}{\tau s + 1}$ will “slow down” its input signal. If we look back at the first order approximation of a second order transfer function using its dominant pole (cf. last question of lab 1 report), i.e., loosely speaking

$\frac{p_1p_2}{(s+p_1)(s+p_2)} \approx \frac{p_{\rm min}}{s + p_{\rm min}},$

can we now make sense of the overlaid graph of step responses of both the original second order transfer function and its first order approximation for each $\zeta > 1$, where the graph of response of first order transfer function is above the corresponding graph of second order original? (i.e., first order response is faster than the second order response.)

### Due Date

Lab 2 Report is due at the beginning of Lab 3 (Sep 28). Prelab 3 is due on Monday by 5pm of the week of Lab 3 (Sep 25). Handwritten prelab is acceptable; typesetting is recommended.

### Questions

You are always very welcome to stop by office hours on Mondays. Emailing questions is another way. You can always include [ECE486]blah in the title of your question emails.

Spot any typos? Email me at once. You will earn up to +5 points for each typo/technical error reported.

## Footnotes:

1
Prelab 3 involves much more work than Lab 3 itself. Please plan ahead and get started as early as possible.
2
You are strongly encouraged to do the partial fraction decomposition by hand since in your midterm and final, any help from electronic devices may not be allowed. So use the solvers like Maple and Mathematica to only verify your work.

Last updated: 2017-09-21 Thu 21:21