The
properties of the output signal can be measured using either the
Simulink scope or a MATLAB plot using the method given in experiment 1.
It is suggested (in the interest of time) to export your data to MATLAB
and then plot it. Using the data cursor measure things like time
difference in peaks. If the number of periods in the MATLAB plot is too
high adjust the "limit data point to" value to a lower number to
effectively zoom in on the waveform. The peak-to-peak voltage of the
input should always be 6 assuming the
amplitude of the sine wave is 3.

Note:
the only measurements that need to be taken whilst conducting this part of the experiment are frequency, time difference between peaks and
peak-to-peak voltage of the output.

The other columns in the table can be calculated as such:

Frequency (Hz) = Frequency(rad/sec)/(2π)

Absolute phase shift (degrees) = (Time Difference in
the peaks)*(Frequency in Hertz)*(360 degrees)

Gain = (Output voltage)/(Input voltage)

Adjust the frequency of the sine wave input from 1 rad/sec to 400 rad/sec
by going up the decades in the semi log axis.

Once all the data is collected produce the bode plots for the motor.

Using what you have learnt in class and in the preparation for this
experiment, calculate the transfer function from the experimental
results. It should be a second order system. If you cannot determine the transfer function from the
bode plot try to draw bode plots for a number of second order systems
with different gains and corner frequencies in order to figure out the relation
between the bode plot and the transfer function.

Compare the bode plots of the motor and the estimated transfer
functions from this experiment and experiment 2 and comment on their
accuracy.

Compare the step response of the motor and the estimated transfer
functions from this experiment and experiment 2 and comment on their
accuracy.

Task 3: Phase and Gain margin measurement

Keep the same system as in earlier tasks.

Adjust the frequency of the reference signal until the reference signal
and output signal have the same peak-to-peak value. Record the phase
shift at the frequency. The phase margin is 180 degrees plus the phase
shift at this frequency for a unit feedback and unit P control system.

Now
adjust the frequency of the reference signal until the reference signal
and output signal is completely out of phase
(phase shift of 180 degrees). Measure the gain of the
system at this frequency in dB. The inverse of this gain
(negative value in dB) is known as the gain margin for
a unit feedback and unit P control system.
When the phase shift of 180 degrees (out of phase) can only be achieved
at an infinite frequency the gain margin will be infinite.

Is this the same as what was expected from the bode plots produced
in Task 2?

Task 4:
Motor Transfer Function of Position Output

Determine the transfer function of the motor when position is the output
in both degrees and radians based on the transfer function for motor velocity determined in Task
2.

**
Tip:**
As this process may be tedious you may wish to use a variable frequency
MATLAB loop to automate the procedure. A template for this is available
here

Note:
The motor speed block in this program should be
replaced using the one you used in previous experiment with output in
rad/sec. The output filter
should be removed by setting its time constant from 0.01 to zero.
The gain at the output of the cos block can be changed for improved
measurements. For example, reduce it at a low frequency in order
to avoid saturation and increase it at a high frequency to reduce the
effects of encoder noise.

You should run the m file
first. Do not build and connect the Simulink program. The
program in the m file will do it for you.

The
following program can be used to view the results.

%Unit of Freq is rad/sec

x=freq_resp.input;

y=freq_resp.output;

Freq=freq*2*pi

[a,b]=size(x)

n=5000;

for i=1:10

figure (i)

plot([x(i,b-n:b);y(i,b-n:b)]')

end