platypus - problem set 2 - university of queensland · platypus - problem set 2 page 6 31/05/2013...

35
Page 1 Platypus - Problem Set 2 31/05/2013 6:35:35 PM http://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143 Home ( / platypus / ) / Problem Set 2 Problem Set 2 Question 10 Question : Q 1 . Graphical Convolution Consider an LTI system with impulse response h ( t ) given below : Suppose the input to the system is : Please plot the output of the system , y ( t ) . [ Hint : please remember to label your plots ] Answer : In order to obtain the output we use the fact that : Graphically this corresponds to flipping one of the functions , shifting it to the right , and integrating the relevant sections to obtain the result of convolution . Since and we can use superposition and find the output for each impulse and then sum the results . This will make the graphical approach more tangible and easier to understand . So let ' s start with . If we flip it we get the second figure , and then we shift it for different values of t , and at each stage we calculate the integral : Viewing as s4251143 Platypus (/platypus/) Home ( / platypus / ) Assessment ( / platypus / assignments / ) Students ( / platypus / studentlist / ) Markers ( / platypus / markers / ) Set Password ( / platypus / users / changepassword / ) Logout ( / platypus / users / logout )

Upload: others

Post on 05-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 1Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

Home (/platypus/) / Problem Set 2

Problem Set 2Question 10Question:

Q1. Graphical Convolution

Consider an LTI system with impulse response h(t) given below:

Suppose the input to the system is: 

Please plot the output of the system, y(t).  [Hint: please remember to label your

plots]

Answer:

In order to obtain the output we use the fact that 

Graphically this corresponds to flipping one of the functions, shifting it to the 

right, and integrating the relevant sections to obtain the result of convolution.

Since   and we can use superposition and find 

the output for each impulse and then sum the results. This will make the 

graphical approach more tangible and easier to understand.

So let's start with   . If we flip it we get the second figure, and then 

we shift it for different values of t, and at each stage we calculate the 

integral:

Viewing as s4251143

Platypus (/platypus/)

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 2: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 2Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

This procedure produces the shifted version of the impulse response. Which is 

expected from a time invariant system. Mathematically this can be proven as:

 

Simply if   is the response to   then the response to   is  . 

The result of convolution for   is therefore:

Repeating the same procedure for the   and    we obtain   

and  . Therefore overall we have the following individual responses:

Now to obtain the overall response we use the superposition principle and sum the 

responses:

Knowing that 

This will give the following output response 

The output therefore becomes:

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 3: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 3Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

And the output alone without dashed lines of individual responses is: 

My estimated grade is: 5 / 5

Complete: Yes

Question 20Question:

Q2. More Convolutions

Suppose an LTI system has the following impulse response h[n] given below:

 

Suppose the input to the system is: x[n] = u[n+1] + u[n‐1] ‐ 2∙u[n‐2]

Please plot the output of the system, y[n].  [Hint: please remember to label your

plots]

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 4: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 4Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

Answer:

First we try to evaluate the input, as this will simplify the solution.

This means that x[n] is simply made of three impulses:

The response to this input is simply the sum of the response to the individual 

inputs. Since we know   is the response to   , from time invariance and 

linearity we simply find that the response to   and   is 

simply   and   so the output y[n] is :

from the figure in question we can see 

that 

therefore the output becomes:

Therefore the output will look like below:

My estimated grade is: 5 / 5

Complete: Yes

Question 30Question:

Q3. A Bilateral Understanding

Janus wants to apply the z‐Transform to a non‐causal signal.  Janus recalls that

this can not be handled unilaterally using the unilateral z‐Transform, but can be

done using the bilateral (or two‐sided) z‐Transform.  Using this, help Janus

determine the z‐Transform of:

Answer:

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 5: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 5Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

If we want to solve this quickly with reference to z transform formula we solve 

as follows:

 

the first part is a right sided z transform because of u[n] and the second part 

is a left sided z transform because of u[‐n‐1].

The transform of both   and   is   but each of this 

discrete functions will have a different Region of Convergence (ROC). For   

we are dealing with a right sided transform and its ROC is   

while   is a left sided transform and has ROC   . So for x[n] we 

will have:

     ROC: 

Note that the region of convergence is the region for which both transforms exist 

and based on the above explanation we find that   to satisfy convergence 

for both functions.

If we want to prove the results through mathematical formula of z transform we 

solve as follows:

Note that we used the property of geometric series to prove the results. And we 

know for a geometric series to be convergent the multiplier ie the ratio between 

the terms should not be 1 or more than 1. From this requirement we can see 

that   and therefore this will be ROC on z plane (the region 

enclosed between two circles of radius 0.9 and 1.2)

My estimated grade is: 5 / 5

Complete: Yes

Question 40Question:

Q4. Ordering a Lowpass Filter Around

Determine the order, n, and corresponding cutoff frequency,    of a lowpass

Butterworth and Inverse Chebyshev filter that satisfies the following

specifications:

 

[Hint: When finding values of ωc please find one that meets or over‐satisfies the

passband specification]

Answer:

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐Butterworth Lowpass 

Filter:‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 6: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 6Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

To find the order of the filter we find the relation between passband gain, 

passband frequency, stopband gain and stopband frequency. To do that we first use 

the transfer function of the Butterworth Lowpass Filter:

So we get:

      (1)

Similarly we have: 

   (2)

Therefore we get:

So we find n as:

Now based on the specification we need   and  . If we 

just substitute   and   and 

also   ,   we obtain n 

= 12. But for any   the requirements are satisfied. For the purposes of 

this question we select n = 12. Knowing the order we can go back to either 

equation (1) and (2) and solve for   .

Remember that the requirements were:    and   . We find 

the required values of   for each requirement:

Imagea)  

 (3)

now if we use n= 12 and   we find that 

b)  

Taking similar procedure:

   (4)

Now if we replace n = 12 and   we obtain 

So to satisfy part a and b  for n = 12. Therefore for 

purposes of this question we choose  .

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐Inverse Chebyshev Lowpass 

Filter:‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐

We use the transfer function for this: 

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 7: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 7Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

Note that in normalized form   is replaced with  . From this equation we 

can obtain passband gain:

Which gives:

Knowing that 

we obtain      (5)

Similar procedure for stopband gain gives:

         (6)

Now so far we have established very important equations. Now in order to solve 

for n and   we look at the function  . This function has two 

alternative forms:

form A)   this is valid when 

form B)   this is valid when 

Knowing that   and   we adopt form B for equation (5) and form A for 

equation (6).

Therefore we will have the following two equations:

    (7)

        (8)

Rearranging for these equations gives:

Although these equations look horrifying, substituting for values of   and 

assuming a ripple ratio   the equations reduce to:

Therefore the relation between   is 

We know the order n should be less than that of the Butterworth, therefore by 

inserting various values of n less than 12 we found n = 4 will satisfy this 

equation.

To evaluate the acceptable range of  , we go back to specifications:

Imagea) 

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 8: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 8Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

using n=4 and the given passband frequency we obtain 

b) 

Similar approach as above will give us the following inequality:

using n = 4 and given stopband frequency we obtain 

So to satisfy both requirements outlines in part a and b we must 

have 

Therefore any value in this range satisfies(or over satisfies) the requirements. 

So we choose a value of 225rad/s as cutoff frequency in this case.

My estimated grade is: 10 / 10

Complete: Yes

Question 50Question:

Q5. Set FIRe to the Reign (of analog filters)

Design a linear phase FIR filter (using the window design method) to meet the

specifications of the lowpass filter problem in Q4.  Determine the required

filter order, N, corresponding cutoff frequency,  , and corresponding delay.

 Then specify the final FIR filter.

=  30 Hz ( =188.5 rad/s)

 = 40 Hz ( =251.3 rad/s)

[Hint: The stopband and passband ripple requirements may be inferred

from   and  . ]

Answer:

*****NOTE: In this question when a window function is selected since the value of 

peak magnitude is close to that of rectangular window function (although it is 

less than ‐21dB). Since the whole windowing method is an approximation for the 

sake of this question this approximation is still justified.

In order to design the digital filter first we have to find the passband and 

stopband ripple requirements. This can be found from the passband and stop band 

gains. We know that: 

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 9: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 9Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

Now we know that   and  . Using this information we find 

the range of expected ripples:

bandpass ripple:

stopband ripple:

Since we know in FIR filters the ripples are equal in passband and stopband we 

conclude that the ripple has to be   or 

Now based on this specification we can refer to table of available window 

functions, and we find that for ripples of this magnitude we can use rectangular 

window function. In order to find the length of the filter (M) we use the 

following relation:

width of mainlobe =   

where  are the normalized stopband frequency 

and passband frequency. In order to normalize the given frequencies we must 

select a sampling frequency. For purposes of this question we choose 

  Therefore we have:

width of mainlobe =

Therefore 

Since N = M‐1 we find that the filter is of order N = 31. The resulting delay is 

equal to:

From FIR filter properties the normalized cutoff frequency is :

This corresponds 

to: 

In order to specify the filter we need to find the coefficients for each delay 

stage. To do that we first find,   the impulse response of the ideal low pass 

filter with this cutoff frequency up to n = 31.

We know that the impulse response of an ideal lowpass filter with normalized 

cutoff frequency   is given by:

In order to use the sinc function in this impulse response we have to take 

samples for n<      0 as well as n=0 and n>0 which is not causal. To make the 

system causal we shift the impulse response by (M‐1)/2  = 15.5 so we will use 

the shifted impulse response:

since M‐1/2 = 15.5 and is not an integer the middle point does not exist. So we 

only end up with:

for 

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 10: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 10Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

The window function is simply 

Therefore the filter coefficients are simply  . 

Using MATLAB the coefficients were found as: 

a0 =0.0130  ,  a1= 0.0194 , a2= ‐0.0068 , a3= ‐0.0253,  a4= ‐0.0027,   a5= 

0.0290,    a6= 0.0158   

a7= ‐0.0289 ,  a8= ‐0.0328 , a9 = 0.0231,   a10= 0.0554 , a11= ‐0.0069 ,  a12= 

‐0.0905 

 a13 =  ‐0.0370,   a14= 0.1871,   a15= 0.4039,   a16= 0.4039,    a17= 0.1871, 

a18= ‐0.0370  

a19= ‐0.0905,  a20= ‐0.0069,   a21= 0.0554,   a22= 0.0231,  a23= ‐0.0328,  a24= 

‐0.0289   

a25= 0.0158,   a26= 0.0290,  a27= ‐0.0027,  a28= ‐0.0253,  a29= ‐0.0068,  a30= 

0.0194 , 

 a31= 0.0130

And the plot of the impulse response is: 

The MATLAB code is as below: 

n = 0;

cof = zeros(1,32);

figure(1)

while n<   32

    cof(n+1) = sin(0.4375*pi*(n‐15.5))/(pi*(n‐15.5));

    hold on;

    stem(n,cof(n+1));

    hold on

    n = n+1;

end

cof

My estimated grade is: 10 / 10

Complete: No

Question 60Question:

Q6. I Hear You

Uncle Robert, having escaped electrocution while improving the lights, has set

his interests on sound.  To get rid of noise he has built a simple second‐order

Butterworth lowpass filter for his stereo.  Although the system performs well,

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 11: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 11Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

the ever entrepreneurial Robert, wants to improve it.  He reckons “twice the

filtering gives twice the performance,” and suggests filtering the audio signal

not once but twice with a cascade of two identical filters.  His idealistic

cousin is skeptical and suggests, “if you are using identical filters, it makes

no difference whether you filter once or twice.”

Who is correct (both, either, or neither)? and why?

Answer:

Neither are right. Having two stages of the same filter will have a different 

effect from having only one filter or having a filter with double the order. So 

the outcome will be different but it will not be twice the performance. Another 

issue that is important is by putting the same filter in cascade we will produce 

repeated poles. Now if some of these poles is on jw axis having, then by putting 

the filters in cascade we get repeated roots on imaginary axis which result in 

unstable system since they give rise to terms like   which 

won't have bounded input as time goes to infinity.

For the case of Uncle Robert we find the poles of the Butterworth filter 

from   for k=1,..., n

if it has poles on the imaginary axis then he is actually doing something bad.

Uncle Robert is using a second order filter so n = 2, and

   for k=1,2

Luckily there are no poles on the imaginary axis so the system will not become 

unstable. Nonetheless the response will not be as good as a filter with twice the 

order.

My estimated grade is: 10 / 10

Complete: Yes

Question 70Question:

Q7.  Driving a Hard Drive

Consider a digital controller for a disk drive system in which the disk spins

with a constant speed and the has a time between readings of T.  This may be

modeled as:

Where

a. Determine G(z)a. Determine G(z). Determine G(z)

b. For T = 1ms, a proportional controller (D(z) = K), what is the open loop

transfer function?b. For T = 1ms, a proportional controller (D(z) = K), what is

the open loop transfer function?b. For T = 1ms, a proportional controller (D(z) =

K), what is the open loop transfer function?

[Hint:  What happens to G(s) (or how can G(s) be simplified) if the fast pole

(s=‐20) is neglected?]

c. What is the closed‐loop transfer function?

[Hint:  Apply the same assumptions as was done in Part b]

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 12: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 12Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

d. For K = 4000, what is the percent overshoot to a step input and the settling

time?

Answer:

a) In order to obtain the Z‐Transform we assume that the delay portion of the 

transfer function (  ) is Zero Order Hold therefore we have :

In order to evaluate the z transform we first find the partial fraction expansion 

of  :

Therefore we can easily convert these continuous time transforms to their 

discrete time equivalents in z domain with reference to z transform tables:

Therefore the overall z transform will be:

b) The open loop transfer function is   . Since T = 

1ms = 0.001s we can substitute T with the given value and write the open loop 

transfer function as:

If we want to find the transfer function neglecting the pole at s = ‐20 first 

apply partial fraction expansion and then neglect the term from s+20:

Neglecting the pole at s= ‐20 the transfer function of the plant will become:

So the discrete transfer function of the plant in z domain using ZOH will become:

and then the open loop transfer function after neglecting s = ‐20 

becomes: 

c) The closed loop transfer function is 

d) for K = 4000 we simply substitute in the closed loop transfer function 

derived in part c and we obtain:

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 13: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 13Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

The poles of this system is at z = 0 which is inside the unity circle and 

therefore is stable. The response corresponds to an exponential   where   

goes to infinity. Therefore the response of this system is instantaneous and the 

settling time   is zero. From practical perspective however there may be a 

delay of 1ms due to sampling period, but the settling time in theory and from the 

z transform is zero.

My estimated grade is: 15 / 15

Complete: Yes

Question 80Question:

Q8. Analog vs Digital Filters

a) Design a 12th order Inverse Chebyshev lowpass filter with a cutoff frequency

of 5000 Hz

(i.e. =2 (5000)) by completing the following:

i) Locate and plot the filter’s poles and zeros in the complex plane.  Plot the

corresponding magnitude response | | to verify proper design.

ii) Setting all resistor values to implement the filter using a cascade of six

second‐order Sallen‐Key filters (as below).  On a single plot, plot the magnitude

response of each section as well as the overall magnitude response.  Identify the

poles that correspond to each section’s magnitude response curve.

b) Design an equivalent 12th order digital lowpass filter with  = /3 

[Hint:  Try Matlab’s cheby2 function] 

Plot the filter’s poles and zeros in the complex z plane and the decibel

magnitude response  .

Answer:

a)

i)

If we want to take the theoretical approach first we design a normalized 

chebyshev filter of order 8. To do that we use the fact that the transfer 

function of a normalized chebyshev filter is:

Image Image     (1)

Where:           (2)

is a polynomial given tables for chebyshev filters of different order, 

and 

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 14: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 14Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

We have to emphasize that   can also be found by identifying the poles of 

the filter and then forming the denominator as 

One of the parameters that we have to choose for design of the chebyshev filter 

is the ripple in passband and that is controlled by  . For purposes of design we 

choose  . Referring to the table of poles for chebyshev filters on page 

519 of Signal Processing and Linear Systems by Lathi we find that the poles for a 

normalized 8th order chebyshev filter are:

Using these poles we can construct  . Also since n = 8 we find from (1) 

that   where   is the last coefficient in   as shown in equation (2)

. After finding  we can form the transfer function for a normalized 

filter whose cutoff frequency is 1 rad/s. Since we are after a filter with cutoff 

frequency of 5000Hz we scale the transfer function by replacing s with   

and that gives the transfer function for the 8th order chebyshev filter with 

cutoff frequency of 5000Hz. 

Since this theoretical approach is computationally intensive we utilized MATLAB 

and the following transfer function was obtained for the normalized filter:

The filter we are after has cutoff frequency of 5000Hz  Therefore we used MATLAB 

function cheby1 which gives the following transfer function(code is given below):

The magnitude response of this filter was then found using the function 

freqs and following magnitude response was plotted:

Using pzmap the pole‐zero plot was generated as below. The imaginary axis has a 

multiplier of 10^4 (due to poor formatting tools in platypus I couldn't enlarge 

the image):

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 15: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 15Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

The MATLAB code is:

[b,a] = cheby1(8,0.5, 2*pi*5000, 's');

[h,w] = freqs(b,a,1024);

Hdb = 20*log10(abs(h));

f = w/(2*pi);

figure(1);

plot(f, Hdb);

%get the transfer function of the filter

T = tf(b,a)

figure(2);

pzmap(b,a);

[z,p,k] = tf2zp(b,a);%get poles and zeros

The above code also gives the poles of the transfer function as below:

     (3)

ii)

Now that we know the transfer function of the system and its poles, designing a 

cascade of sallen‐key filters is easy. Simply we have to design it such that 

each stage will have one of the four pairs of complex conjugate poles in (3) so 

that overall we have a system with the 8 poles of the the 8th order chebyshev 

filter we designed in previous part.

We know that the lowpass sallen‐key filter given in question has the transfer 

function:

Image   (4)

where   and  . (5)

Now we produce the transfer function for each stage from the poles in (3):

stage1) poles: 

So the transfer function of this stage will be:

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 16: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 16Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

Now based on the relations in (5) we have :

If we choose   then we find: 

 and from this:

 

If we take   then we can 

find   

stage2) poles: 

So the transfer function of this stage will be:

Following the same procedure as above we have:

 

Taking   we find that:

Choosing   we find that  . 

stage3)

So the transfer function for this stage will be: 

Again similar to previous stages we have: 

Again assuming Image Image Image Image   again we can find other elements 

similar to stage 1 and 2:

stage4) poles: 

So the transfer function for this stage is :

again similar to previous stages we have:

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 17: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 17Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

Again assuming   again we can find other elements similar to stage 1, 2 

and 3:

Therefore we design with 

The responses to each were plotted and the following result was obtained:

And the overall response of the cascade is:

The MATLAB code for this part is attached at the end of the answer in an attempt 

not to crowd the main part of solution.

b)

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 18: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 18Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

To design a digital a digital 8th order chebyshev filter, MATLAB was used in a 

similar fashion and following magnitude response and pole‐zero plots were 

generated:

Pole‐Zeros plot in z‐domain is :

The MATLAB code is:

[z,p,k] = cheby1(8,0.5, 1/3); % n = 8, a normalized cutoff frequency of pi/3, 

0.5dB ripple

[sos, g] = zp2sos(z,p,k);

Hd = dfilt.df2tsos(sos,g);

freqz(Hd);

MATLAB Code for Sallen‐Kay Cascade Solution ‐ ii)

b1 = [998731229];

a1 = [1 2740 998731229];

stage1 = tf(b1,a1);

b2 = [731644360];

a2 = [1 7804 731644360];

stage2 = tf(b2,a2);

b3 = [353978825];

a3 = [1 11680 353978825];

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 19: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 19Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

stage3 = tf(b3,a3);

b4 = [86896721];

a4 = [1 13778 86896721];

stage4 = tf(b4,a4);

result = stage1*stage2*stage3*stage4; %cascade the stages

[h1,w1] = freqs(b1,a1,1024);

Hdb1 = 20*log10(abs(h1));

f1 = w1/(2*pi);

subplot(2,2,1);

plot(f1,Hdb1);

title('stage 1 magnitude response');

[h2,w2] = freqs(b2,a2,1024);

Hdb2 = 20*log10(abs(h2));

f2 = w2/(2*pi);

subplot(2,2,2);

plot(f2,Hdb2);

title('stage 2 magnitude response');

[h3,w3] = freqs(b3,a3,1024);

Hdb3 = 20*log10(abs(h3));

f3 = w3/(2*pi);

subplot(2,2,3);

plot(f3,Hdb3);

title('stage 3 magnitude response');

[h4,w4] = freqs(b4,a4,1024);

Hdb4 = 20*log10(abs(h4));

f4 = w4/(2*pi);

subplot(2,2,4);

plot(f4,Hdb4);

title('stage 4 magnitude response');

figure(2);

[b_result a_result] = tfdata(result);

[h_result w_result] = freqs(cell2mat(b_result), cell2mat(a_result),1024);

Hdb_result =  20*log10(abs(h_result));

f_result = w_result/(2*pi);

plot(f,Hdb_result); %plot the overall frequency response

My estimated grade is: 20 / 20

Complete: Yes

Question 90Question:

Q9. Digital Control

Part I:  [10 points]

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 20: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 20Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

Sketch the root locus of the system:   in feedback with a 5Hz

controller implementing:

a) a lead compensator

b) a lag compensator

Which is more robust to arbitrarily large system gains?

Part II:  [20 points]

For what range of proportional feedback gains are the following systems stable?

i) 

ii)  , 20 Hz (approximate with Tustin’s method

where  )

iii) Image Image Image, 20 Hz (using exact z‐Transform)

Answer:

Part I)

First we take the Laplace transform of the differential equation:

In z domain assuming ZOH the transfer function will 

be: 

which means there's a zero at z = ‐1 and two poles at z = 0.9015 + 0.4328i and 

z=0.9015 ‐ 0.4328i.

Now knowing that fs = 5Hz and Ts = 0.2s we use MATLAB to plot the root locus of 

the following:

a) lead compensator

For this case we choose an arbitrary zero location in s domain (since we are not 

given any specification on transient response). For purposes of this problem the 

following compensator was chosen:

 which has a zero at ‐1 and pole at ‐20. Using  MATLAB the 

transfer function in s domain was then converted to a discrete transfer function 

in z domain using c2d  function assuming matched poles and zeros: 

. Then the open loop transfer function is 

simply  and we can plot the root locus by rltool as below:

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 21: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 21Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

b) lag compensator

For case of lag compensator again since no specification is provide an arbitrary 

pole and zero close to imaginary axis is chosen:

Again using  MATLAB the transfer function in s domain was then converted to a 

discrete transfer function in z domain using c2d  function assuming matched poles 

and zeros. The matched poles zeros transfer function will 

be:  . Then  the open loop transfer function is 

 and the root locus can be plotted by rltool as below:

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 22: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 22Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

From the plots we can see that the lead compensator seems to provide a wider 

range of possible gains while maintaining the stability. On the other hand the 

lag compensator seems to be very unstable and in fact we can see a small gain 

results in instability in the system. Therefore the lead compensator seems to be 

more robust for larger gains for this plant. Although at some point we can see 

even lead compensator becomes unstable for very large gains.

MATLAB Code:

 plant = tf([2],[1 0 5]); % create plant in s domain

 plantz = c2d(plant, 0.2,'zoh'); %convert to z domain by zoh

 lead_comp =  tf([1 1],[1 20]); %create lead compensator

 lag_comp =  tf([1 0.01],[1 0.001]); %create lag compensator

 

lead_compz = c2d(lead_comp,0.2,'matched'); %get the overall transfer function in 

z

lag_compz = c2d(lag_comp,0.2,'matched');

 plant1z = lead_compz*plantz; %convert to discrete transfer function

 plant2z = lag_compz*plantz;

 rltool(plant1z); %plot root locus

 rltool(plant2z);

Part II)

i)

The closed loop transfer function for gain feedback K is :

Therefore the pole will be at:

 and for this to be stable the pole has to be in the unity 

circle so :

Therefore 0.998<        K<        20 is the range for which the system will 

remain stable.

ii) 

With Tustin's method we have :  so we simply substitute s with this 

transformation in the transfer function knowing that T = 0.05 to get the overall 

system's transfer function in z domain. Instead we use c2d function in MATLAB:

plant = tf([2],[1 6 9]);

plantz = c2d(plant, 0.05, 'tustin');

rlocus(plantz);

[k poles] = rlocfind(plantz);

The above code gives the transform of H(s ) as:

 and the rootlocus plot of the 

feedback system Image Image Image   is:

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 23: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 23Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

As the root locus shows the system is stable up to very large gain since the root 

locus is in unity cirlce (we can claim from the plot almost infinity, since the 

zero is at ‐1 where it becomes marginally stable). However using rlocfind 

function a gain equal to 1.8637e+015 is given for z = ‐1. Nonetheless that's 

MATLAB computation and from the rootlocus we conclude the system is overall 

stable for all values of K.

iii) 

In this part we will use exact z transform method to obtain the maximum allowable 

gain K for maintain stability. To do this we use the definition of the Z 

transform, before doing so we have to use inverse Laplace Transform to obtain 

time domain function h(t):

So the Z transform is:

Now we take   and therefore we will have:

Now using the property   and knowing that in the above equation x

[n] = u[n] we find that H(z) is:

 where   so 

overall:

Since f = 20Hz and T = 0.05 and   we obtain the closed loop 

transfer function as below:

Now we can obtain the root locus plot using MATLAB tf function as below:

plant = tf([0 0.116],[1.347921 ‐2.322 1 ], 0.05);

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 24: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 24Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

rlocus(plant);

[k poles] = rlocfind(plant)

Using rlocfind it was found that the system poles will cross the unity circle(and 

becomes unstable) at a gain of 2.9874 with poles: 0.8613 + 0.5071i and 0.8613 ‐ 

0.5071i . 

My estimated grade is: 30 / 30

Complete: Yes

Question 100Question:

Q10. Its Not Easy Being Stable

Professor Honeydew has a new machine, Leviathan. Much like a magnetic bearing in

turbomachinery, this suspends ferromagnetic material (or a weight to which a

magnet has been attached) by means of an electromagnet whose current is

controlled by the position of the mass.

(http://goo.gl/4xwsc)

 

The equation of motion is:       where the force on the ball

due to the electromagnet is given by    At equilibrium the magnet force

balances the gravity force. Let   represent the current at equilibrium, then we

can linearize this system about x=0 and  =  to get:  .

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 25: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 25Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

The Professor’s assistant, Beaker, has estimated the values of the constants as:

m=1 kg,  = 50N/m, and   = 1 N/A.  

a. Continuous transfer function. Compute the transfer function from I to x (i.e.,

G(s)= .

b. Continuous to discrete. Assume the input is passed through a zero order hold

(ZOH) with a sampling frequency of 100 Hz. Compute the equivalent discrete‐

time plant transfer function.

c. Digital controller.  Design a digital control for the magnetic levitation

device so that the closed‐loop system has a rise time of less than 160

milliseconds (  ≤ 0.159s), a settling time of less than 460 milliseconds (  ≤

0.46s), and overshoot (  ≤ 20%).

d. Root Locus.  Plot a root locus with respect to      Please discuss the

possibility of using your closed‐loop system to balance frogs of various

masses and with more damping (e.g. greater air resistance or if it has wings).

e. Step Response. Plot the step response of your design to an initial (unit)

disturbance. Show this for both the output response ( ) and the control

effort ( )

f. Noise. Beaker replaces the sensor with a new one that uses mains. This new

sensor is very noisy with 50Hz noise of the same amplitude at the signal

(SNR=1). Design a filter to process this sensor’s output (include the specific

type and order of FIR or IIR or analog filter). What will happen if the order

is too great?

g. Saturation. What would happen if the solenoid has a limit of 1A and a latency

of 100 milliseconds.

Answer:

a)

First we transform the differential equation to Laplace Transform and then we 

rearrange to obtain the transfer function:

Since m = 1kg and k1 = 50N/m and k2 = 1N/A the transofer function becomes:

b) Knowing that the sampling rate is f = 100Hz we find that T = 0.01s and 

therefore we find the discrete transfer function with Zero Order Hold as below:

To obtain the Z transform we use partial fraction expansion:

Where by cover up rule we have :

So now we can find the Z transform of the s‐domain terms knowing that T = 0.01s:

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 26: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 26Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

Therefore the overall discrete transfer function H(z) becomes:

Alternatively we could also use MATLAB function c2d  with 'zoh' to obtain the 

transfer function.

plant = tf([1].[1 0 ‐50]);

plantz = c2d(tf,0.01,'zoh')

which gives 

c) To design the digital controller first we design in s domain based on the 

requirements and then we transform the controller to a digital controller through 

approximation methods:

The requirement asks for a settling time of maximum less than 460ms this means 

that the closes distance to imaginary axis for system poles must be:

   (1)

So the poles real part must be ‐10 or less(more negative). From the required 

percent overshoot we can also derive the minimum damping ratio required:

 (2)

This damping ratio corresponds to a radial line of   . Note that (1) 

and (2) together require that  rad/s.

The design spec further asks for a rising time of less than 0.159s:

   (3)

We can see satisfying (1) and (2) will satisfy (3) as well. Therefore to meet 

specifications it is sufficient to design a controller whose poles are to the 

left of the line s = ‐10 and are between the lines associated with damping ratio 

0.456. In other words the closed loop system poles must be in the following 

region:

Therefore we have to design our compensator in such a way that the root locus 

passes through the region shaded above. 

To design our compensator first we see that requirements are on transient 

response and nothing is mentioned about the steady state error. So we will use a 

lead compensator to satisfy the transient requirements. The lead compensator 

introduces a zero and pole so that the root locus of the overall system passes 

through the desired points. 

For purposes of our design we choose a zero at ‐18.7 so we can keep the 

compesator pole far enough from the system poles so that we can use second order 

approximations appropriately. In order to make the root locus pass through a 

specific point we can use the angle criteria( ) to locate the 

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 27: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 27Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

compensator pole or we can use SISO tool in MATLAB to place the pole in such a 

way that the root locus passes the region shown above. Since the theoretical 

method still requires verification through simulation we can directly use SISO 

tool.

Using SISO tool we can easily find that if we place the compensator pole at ‐357 

the  compensator transfer function will become:  and root locus 

of the system will become as shown below:

We can see that the parts of the root locus is in the desired region, therefore 

we can choose an appropriate gain to have the system poles in this region. The 

figure above shows the pole locations for a gain of K = 21876. For this value 

the dominant poles are at   and the third pole is at  ‐282. 

Therefore the percent overshoot, settling time and rising time specification is 

satisfied with the following controller:

Now that the design is completed in s domain we continue the emulation method to 

create the digital controller. To do that we choose the tustin method to convert 

the controller in s domain to z domain: 

d) Now that we have obtained the controller from the emulation procedure we can 

easily find the step response. To do that we simply convert the plant and 

controller to discrete and then we obtain the closed loop transfer function. 

Then to get the step output all we have to do is to call step function. To 

obtain the step output information we can simply call stepinfo function:

K = 21786;

plant10 = tf([1],[1 0 ‐50]); %plant

%Gc = tf([1 20],[1 129.94]);%compensator

Gc = tf([1 18.7],[1 357]);

Gcz = c2d(Gc, 0.01, 'tustin');

plant10z = c2d(plant10,0.01,'zoh');

G = Gcz*plant10z; %minor loop transfer function

figure(1)

rlocus(G);

closed_loop = feedback(K*G,1); %closed loop transfer function

%dclosed_loop = c2d(closed_loop,0.01,'zoh');%discretization

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 28: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 28Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

figure(2);

step(closed_loop);

stepinfo(closed_loop)

Using this code the step response (step input i ) was obtained as below:

RiseTime: 0.0100

SettlingTime: 0.1400

Overshoot: 26.1981

  

            

The step response of the continuous control system from which the digital system 

was derived is as below. As can be seen this continuous design meets all 

specifications. However we see that during the process of transforming to 

digital domain the step response is no more giving the desired overshoot although 

it satisfies the settling time and rising time. This is due to sampling effect 

and the approximations made in transforming from continuous to discrete domain .

RiseTime: 0.0211

SettlingTime: 0.1498

Overshoot: 15.2126

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 29: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 29Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

To solve this larger overshoot in digital domain we could instead design a 

compensator which gives poles with more damping to compensate for the increased 

overshoot. For example we could go and make a compensator like :  

and use it with a gain of 20,000 and that would give real closed loop poles as 

below:

However we will stick to our original compensator for the rest of this question, 

but the explanation that was just given sheds light on how we could improve the 

design.

The step response for effort i can be obtained easily by rearranging the control 

block diagram loop to have desired position as input and effort i as output. This 

will give the following transfer function:

This will give the following step response for effort i by calling the step 

function in MATLAB:

By applying stepinfo the final settling value is found to be 55.3922 A .

e) In order to design filter for the noisy sensor we should first consider the 

aliasing that can arise from the sampling. Since the sampling frequency is 100Hz 

from Nyquist and aliasing criteria we find that any frequency from 50Hz or larger 

will be aliased. Therefore an antialiasing filter has to be applied in the 

feedback path and before the sampler so that aliasing is avoided. Interestingly 

in this problem we are also dealing with a 50 Hz noise. Therefore a proper 

antialiasing(lowpass) filter would get rid of the noise as well. Note that it is 

crucial to put the filter before the sampler so that we can avoid "any" 

aliasing. This means that we must design an analog filter if we want to maintain 

the sampling frequency at 100 Hz, and if we want a better and smoother filtering. 

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 30: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 30Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

Note however the order of the filter is really dependent on the number of bits in 

ADC of controller, as the number of bits specifies how sensitive our sampler is 

in picking up variations. Therefore the amplitude reduction in principle depends 

on number of bits. Since the number of bits is not provided in this problem we 

have to assume an amplitude for stopband frequency of 50Hz, and based on that 

design a filter. 

First we choose the type of the filter. Since we would like a smooth passband and 

stopband we go for a Butterworth lowpass filter, and we assume the the amplitude 

at stopband frequency   ( ) is ‐20dB. We also choose the 

passband frequency as   ( ) and passband gain as ‐0.5dB. 

From these assumptions we are able to derive the order of the filter and the 

cutoff frequency:

Therefore an analog Butterworth  lowpass filter with order 15 and cutoff of 

269.58 rad/s will get rid of the noise and also avoid aliasing. However the 

large order n = 15 can potentially result in latency (delay) and therefore 

instability and/or large overshoot. Since the system will not be able to 

compensate fast enough. Also the dynamics of the filter ie the poles of 

Butterworth filter can change the rootlocus of the overall closed loop system. In 

this case designing a filter with sharper  cutoff region for lower orders can 

help, for example chebyshev and inverse chebyshev can satisfy the same spec with 

lower orders but they introduce the ripples in passband and stopband. 

f) The open loop transfer function 

is: 

giving this transfer function to rlocus function or rltool we obtain the root 

locus diagram in z domain below:

The s domain root locus was presented during the design process in part c.

If we want to plot the root locus with regards to k1 first we derive the open 

loop transfer function with regards of plant with k1 as unknown. To do that 

first we derive the transfer function of the plant:

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 31: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 31Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

 

Then the open loop transfer function is   where 

  .

Now looking at the equations especially the transfer function of plant which 

contains exponential terms of k1 and also 1/k1, the root locus will only 

effected by the exponential terms since they change the pole locations. The 1/k1 

only serves as a factor and changes the gain. So the essence of root locus, the 

location of poles and zeros is controlled by exponential terms. We can 

put   and rewrite the transfer function based on   and then plot the 

root locus. So first we simplify the above equation with   :

So we can see that   Image  Imageis only affecting the poles and it 

does not change the zeros of open loop transfer function. So we can apply simple 

Root Locus Equation based on the denominator of the open loop transfer function. 

Note that we have taken into account z+0.2819 from the compensator transfer 

function:

We can clearly see that   looks like a gain in root locus equations. So 

if we make   then the root locus can be plotted for values of p. The 

value of p is then related to k1 through    (T = 0.01) so we get a root 

locus for k1. The root locus equation will be:

 

and root locus with respect with k1 looks like below. Note however care must be 

taken in mapping the gain with k1:

MATLAB code for this rootlocus:

 tfk1 = tf([‐1 ‐0.2819 0],[1 0.2819 1 0.2819],0.01);

 rlocus(tfk1)

g) To see the effect of saturation first we have to look at the response of the 

effort i to a step input. As plotted above the effort will go to very large 

values as it is compensating for the errors and then finally settles on 55.392 

A. When there's saturation of 100A this means the effort cannot compensate as 

much as it is required to. In other words the step response of effort i will be 

clipped at 100A and ‐100A. This will give rise to larger overshoot, slowed 

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 32: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 32Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

response and steady state error as the controller has not been able to provide 

the plant with all the necessary compensation input. Implementing the control 

system in Simulink in s domain approves the results as seen below:

The step response with saturation only is as below:

The effect of latency is however more drastic especially for latency of 10ms 

which is equal to one sample time. This will make the control system overshoot a 

lot more when modeled s domain as tested in Simulink, This can lead 

to instability when implemented in digital control. .

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 33: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 33Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

The combination of both the saturation and latency is an even worse mix and the 

system will become unstable and Simulink one again approves that as below: 

Therefore the system will be unstable if both saturation and latency are present.

NOTE: The y axis of the plots in this part represent the position response in its 

units for example m. 

#############################My Own Thinking Zone##############################

 

Therefore the poles will have to be at 

Therefore we have to design our compensator in such a way that the root locus 

passes through these poles and note that this is the minimum requirement. We 

could go and choose poles which are more to the left and are on radial lines of 

smaller angles to have smaller settling time and smaller overshoot. 

To design our compensator first we see that requirements are on transient 

response and nothing is mentioned about the steady state error. So we will use a 

lead compensator to satisfy the transient requirements. The lead compensator 

introduces a zero and pole so that the root locus of the overall system passes 

through the desired points. 

For purposes of our design we choose a zero at ‐15 so we can keep the compesator 

pole far enough from the system poles so that we can use second order 

approximations appropriately.

Choosing z = ‐20 and knowing that the root locus passes through 

    we are able to find the compensator pole from angle criteria. 

The angle criteria says 

Before proceeding to find the angles first we should find all poles and zeros of 

open loop system:

plant poles: 

compensator pole and zero : 

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 34: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 34Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

So angles will 

be: 

From this we can find the angle contribution from the pole:

degrees

Now using the geometry and trigonometry we find the pole of compensator at:

So the compensator will be: 

Using MATLAB rlocus function we found the corresponding gain to operate the 

system at   to be K = 2450 where K is the proportional gain of the 

controller. The position of the compensator pole of the system for this gain is 

shown in the figure below:

We clearly see that the compensator pole is more than 5 times the dominant poles 

and therefore a second order approximation is valid. Therefore it is expected to 

obtain the desired response with this compensator and a proportional gain of 

2450. Note that the system will be unstable for small gains due to the pole in 

the RHP.

Now that we have designed the compensator in s domain we simply take it to z 

domain and convert it to a digital controller:

But we also have the gain K = 2450. So the overall controller transfer function 

will be:

if we are sampling with f = 100Hz then T = 0.01 and using zero order hold we 

have:

if "controller" input (not the whole system) is u[n] and output is r[n] then the 

input output relationship is as below:

 

The discrete representation will be:

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)

Page 35: Platypus - Problem Set 2 - University of Queensland · Platypus - Problem Set 2 Page 6  31/05/2013 6:35:35 PM To find the order of the filter we find

Page 35Platypus - Problem Set 2

31/05/2013 6:35:35 PMhttp://robotics.itee.uq.edu.au/platypus/pages/viewassessment/8/s4251143

d) To sketch the root locus first we have to find the root locus equation based 

on k1.

e)

The step response was plotted using the following code:

plant10 = tf([1],[1 0 ‐50]); %plant

Gc = tf([1 20],[1 129.94]);%compensator

G = Gc*plant10; %minor loop transfer function

figure(4)

rlocus(G);

closed_loop = feedback(2450*G,1); %closed loop transfer function

dclosed_loop = c2d(closed_loop,0.01,'zoh');%discretization

figure(5);

step(closed_loop);

My estimated grade is: 40 / 40

Complete: Yes

Beta -

IxD (http://www.itee.uq.edu.au/ixd) / RDL (http://robotics.itee.uq.edu.au/)

Home (/platypus/)

Assessment (/platypus/assignments/)

Students (/platypus/studentlist/)

Markers (/platypus/markers/)

Set Password(/platypus/users/changepassword/)

Logout (/platypus/users/logout)