Continuous to Discrete

We will start using the following transfer function (Continuous Time).

Open the Bode Plot of G(s)

  1. Get the cutting frequency from the Bode Plot and based on it, the sampling time
  2. Using Matlab, calculate G(z)
clc
clear

%---------- CONTINUOUS TIME TRANSFER FUNCTION ----------%
numerator = 250;
denominator = [1 30 400];
Gs = tf(numerator, denominator);

%---------- BODE PLOT ----------%
% You will place a Data Cursor over the "starting point" of the plot,
% write down the Magnitude (dB) and then place another Data Cursor
% 10 dB after the first Magnitude. Write down the Frequency of the second
% Data Cursor.
bode(Gs);

%--------- FC, FS, T ----------%
% You are now ready to obtain the sampling time based on the cutting
% frequency from the previous step
fc = 34; % You should change this field according to G(s) Bode Plot
fs = fc*7;
T = 2*pi/fs;
Ts = round(T,2); % The sampling time must be rounded up (2 decimal places)

%---------- DISCRETE TIME TRANSFER FUNCTION ----------%
Gz = c2d(Gs, Ts);

Using the previous code, you should get the following transfer function (Discrete Time). We will use this TF from now on.

results matching ""

    No results matching ""