Control systems + TP

ME-321

Discretization exercise

This page is part of the content downloaded from Discretization exercise on Wednesday, 25 December 2024, 17:04. Note that some content and any files larger than 50 MB are not downloaded.

Page content

In this exercise you will go through the steps to implement in matlab a difference equation that you derived from a given transfert function H(s),
steps are:

  1. Given the transfer function H(s) = 1 / (a*s + 1) 
  2. Get H(z) using Tustin approximation, by hand
  3. Derive the difference equation y(k), by hand
  4. In Matlab, write the code that computes difference equation y(k) function of the current/previous y and u and relative coefficientsBe careful with your indexes, especially when you access the k-1 sample.
  5. To compute the coefficients, use sampling period T = 0.04 [s],  a = 0.2
  6. Define the step input  U = ones(1, nSteps); # nSteps = 50
  7. Compute the y(k) function of Y and U, for each k going from 1 to nSteps
  8. Plot the result,  you can use 'stair(X,Y)' to plot your resulting Y.
  9. Then compared your result with the Y* computed using the 'tf([num],[den])', 'c2d(Hs,T,'tustin')' and 'step(Hz)' built-in function, they should be identical.