List of all the MATLAB commands related to transfer function, pole-zero-gain and step response.

   Create Transfer Functions

   Using Equation:

  • Type the command to assign the numerator and denominator coefficient vectors of the transfer function you need to obtain.

      s = tf('s');

      G = (s+1)/(s^+0.1s+10); %example Transfer function

   Using Numerator and Denominator Coefficients:

  • create continuous-time single-input, single-output (SISO) transfer functions from their numerator and denominator coefficients using tf command.

      G = tf(num,den);

   Using Zeros, Poles, and Gain:

  • z and p are the zeros and poles (the roots of the numerator and denominator, respectively). k is the gain of the factored form. 
  • G is a zpk model object, which is a data container for representing transfer functions in zero-pole-gain (factorized) form.

      G = zpk(Z,P,K);

   flit Command:

  • Specify discrete transfer functions in DSP format

      sys = filt(num,den)

 

   System variable conversions

   Transfer function to State-space model:

  • A state-space model can be extracted from the system variable G with the following command:

      [A,B,C,D] = ssdata(G);

                           or

      [A,B,C,D] = tf2ss(num,den);

  • This state-space representation can be stored in another (equivalent) system variable, H, with the following commands which returns the following output showing the relationships between the state, input, and output variables

      H = ss(A,B,C,D)

   State-Space to Transfer Function:

  • If you have a set of state-space equations and you would like to convert them to the equivalent transfer function. This is done using the command

      [num,den] = ss2tf(A,B,C,D)

   State-Space to Zero/Pole and Transfer Function to Zero/Pole:

  • zpk model is basically the same as the transfer function model, except that the polynomials have been factored so the poles are all in the denominator and the zeros are in the numerator.

        The commands to get the system into zero-pole form are:

       Transfer Function to Zero/Pole:

      [z,p,k] = tf2zp(num,den);

       State-Space to Zero/Pole:

      [z,p,k] = ss2zp(A,B,C,D);

   Pole/Zero to State-Space and Pole/Zero to Transfer Function:

  • To get the state-space model from pole-zero, enter the following command:

      [A,B,C,D] = zp2ss(z,p,k);

  • To get the Transfer function from pole-zero, enter the following command:

      [num,den] = zp2tf(z,p,k);

 

   System Stability

  • The representation of transfer functions in MATLAB is mostly helpful once analysing system stability. By analysing the poles (values of s where the denominator becomes zero) we can determine the stability of the system.
  1. If all poles have negative real values, then the system can be defined as stable.
  2. If any pole contains a positive real part, then the system is unstable.
  3. If we tend to analyse the poles on the advanced s-plane, then all poles should be within the left half-plane (LHP) to make sure stability.
  4. If any pair of poles are on the imaginary axis, then the system is marginally stable and also the system can oscillate.

   Finding the poles of the Linear Time-Invariant system

  • Finding the poles of the Linear Time-Invariant system model in MATLAB using “pole command”

      G = tf(num,den);

      P = pole(G)

   Generating the pole-zero map

  • Generating the pole-zero map on MATLAB to determine the system stability

      G = tf(num,den);

      pzmap(G)

 

   Time response of a system

   Step and Impulse Responses

  • The time response represents however the state of a dynamic system changes in time once subjected to a specific input. The time response of a linear dynamic system consists of the sum of the transient response that depends on the initial conditions and also the steady-state response that depends on the system input.

   Obtaining the step response 

      G = tf(num,den);

      step(G)

   Obtaining the impulse response 

      G = tf(num,den);

      impulse(G)

   Determining the step response characteristics

      G = tf(num,den);

      stepinfo(G)

 Based on these poles the step response divided into four cases.

  1. Underdamped response: The response has an overshooting with a little oscillation which ends from complex poles within the transfer function of the system.
  2. Critically damped response: The response has no overshooting and reaches the steady-state value within the quickest time. The critically damped response is the quickest response with no overshooting.
  3. Over-damped response: No overshooting can be seen and reach the final in some in some time larger than critically case. Over damped response is results from the existence of real & distinct poles.
  4. Un-damped response: A large oscillation can be seen at the output and cannot reach a final value and this due to the existence of imaginary poles within the transfer function of the system and also the system during this case is named “Marginally stable”

 

   Frequency response of a system

   Bode Plot

  • Bode Plot is a graphical method used for design and analysis purpose of the control system. In the Bode Plot, a logarithmic scale is used that helps in simplifying the way to graphically represent the frequency response of the system.

        Magnitude Plot: In this plot, magnitude is represented in logarithmic values against logarithmic values of frequency.

        Phase Angle Plot: Here, the phase angle in degrees is sketched against logarithmic values of frequency.

      bode(G);

    Gain margin, phase margin, and crossover frequencies

  • margin(sys) plots the Bode response of sys on the screen and indicates the gain and phase margins on the plot. Gain margins are expressed in dB on the plot.

       [Gm,Pm,Wcg,Wcp] = margin(sys)

         Gm - Gain Margin, Pm - Phase Margin, Wcg, Wcp - Crossover frequencies

          

     Phase Cross Over Frequency: It is the frequency, where phase shift becomes -180o.

     Gain Cross Over Frequency: It is the frequency at which amplitude ratio becomes 1 or log modulus of transfer function becomes 0.

     Marginal stability: In frequency domain,   `G(jω)=−1`

                                How far -1 is from open loop transfer function GH (jω) measures the stability of a system.

     Gain Margin: It can be described as an increase in the open-loop system gain |GH (jω)| when system phase is at 180. Which will cause marginal stability of a system.

     Phase margin: The phase margin Pm is in degrees, amount of phase, which can be increased or decreased without making the system unstable


Comments