Project

To Study about the Theory of Bode Plot and Step Response.

AIM : To Study about the Theory of Bode Plot and Step Response.

OBJECTIVES :

  1. List all the MATLAB commands related to transfer function, pole-zero-gain and step response. Apply all the commands for the Transfer Functions in MATLAB.

  2. For the unity feedback system shown in figure below -

    Determine the closed loop step response using MATLAB commands. Comment on the result.

  3. Explain the MATLAB model ‘scdspeedctrl’. Comment on results for non-tuned PID gain values.

    ( Click here scdspeedctrl )

  4. What is the importance of bode plot for control system design ? Using MATLAB, make a bode plot of the transfer functions.

STUDY - 1 :

Transfer Function Representations :

  • The transfer function of the LTI system is the ratio of Laplace transform of output to the Laplace transform of input of the system by assuming all the initial conditions are zero.
  • In the above system, the input is x (t) and output is y(t). After taking Laplace Transform of the whole system, x(t) becomes X(s), y(t) becomes Y(s). we consider all the initial conditions are 0 because –

Commands for Creating Transfer Function :

Command

Description
tf Create tf objects representing continuous-time or discrete-time transfer functions in polynomial form.
zpk Create zpk objects representing continuous-time or discrete-time transfer functions in zero-pole-gain (factorized) form.
filt Create tf objects representing discrete-time transfer functions using digital signal processing (DSP) convention.

Pole-Zero-Gain Representations :

Use zpk to create zero-pole-gain models, or to convert dynamic system models to zero-pole-gain form.

Zero-pole-gain models are a representation of transfer functions in factorized form. For example, consider the following continuous-time SISO transfer function :

G(s) can be factorized into the zero-pole-gain form as :

A more general representation of the SISO zero-pole-gain model is as follows :

Here, z and p are the vectors of real-valued or complex-valued zeros and poles, and K is the real-valued or complex-valued scalar gain.

Commands for Creating Pole-Zero-Gain :

Command Description

sys = zpk(zeros,poles,gain)

sys = zpk(zeros,poles,gain) creates a continuous-time zero-pole-gain model with zeros and poles specified as vectors and the scalar value of gain. The output sys is a zpk model object storing the model data. Set zeros or poles to [] for systems without zeros or poles. These two inputs need not have equal length and the model need not be proper (that is, have an excess of poles).

sys = zpk(zeros,poles,gain,ts)

sys = zpk(zeros,poles,gain,ts) creates a discrete-time zero-pole-gain model with sample time ts. Set ts to -1 or [] to leave the sample time unspecified.

sys = zpk(zeros,poles,gain,ltiSys)

sys = zpk(zeros,poles,gain,ltiSys) creates a zero-pole-gain model with properties inherited from the dynamic system model ltiSys, including the sample time.

sys = zpk(m)

sys = zpk(m) creates a zero-pole-gain model that represents the static gain, m.

sys = zpk(___,Name,Value)

sys = zpk(___,Name,Value) sets Properties of the zero-pole-gain model using one or more name-value pair arguments for any of the previous input-argument combinations.

sys = zpk(ltiSys)

sys = zpk(ltiSys) converts the dynamic system model ltiSys to a zero-pole-gain model.

sys = zpk(ltiSys,component)

sys = zpk(ltiSys,component) converts the specified component of ltiSys to zero-pole-gain model form. Use this syntax only when ltiSys is an identified linear time-invariant (LTI) model such as an idss or an idtf model.

s = zpk('s')

s = zpk('s') creates a special variable s that you can use in a rational expression to create a continuous-time zero-pole-gain model. Using a rational expression can sometimes be easier and more intuitive than specifying polynomial coefficients.

z = zpk('z',ts)

z = zpk('z',ts) creates special variable z that you can use in a rational expression to create a discrete-time zero-pole-gain model. To leave the sample time unspecified, set ts input argument to -1.

Step Response Representations :

Commands for Creating Step Response :
Command Description
step(sys) step(sys) plots the response of a dynamic system model to a step input of unit amplitude. The model sys can be continuous- or discrete-time, and SISO or MIMO. For MIMO systems, the plot displays the step responses for each I/O channel. step automatically determines the time steps and duration of the simulation based on the system dynamics.
step(sys,Tfinal) step(sys,tFinal) simulates the step response from t = 0 to the final time t = tFinal. The function uses system dynamics to determine the intervening time steps.
step(sys,t)

step(sys,t) plots the step response at the times that you specify in the vector t.

step(sys1,sys2,...,sysN,___)

step(sys1,sys2,...,sysN,___) plots the step response of multiple dynamic systems on the same plot. All systems must have the same number of inputs and outputs. You can use multiple dynamic systems with any of the previous input-argument combinations.

step(sys1,LineSpec1,...,sysN,LineSpecN,___)

step(sys1,LineSpec1,...,sysN,LineSpecN,___) specifies a color, line style, and marker for each system in the plot. You can use LineSpec with any of the previous input-argument combinations. When you need additional plot customization options, use stepplot instead.
step(___,opts) step(___,opts) specifies additional options for computing the step response, such as the step amplitude or input offset. Use stepDataOptions to create the option set opts. You can use opts with any of the previous input-argument and output-argument combinations.
y = step(sys,t) y = step(sys,t) returns the step response of a dynamic system model sys at the times specified in the vector t. This syntax does not draw a plot.
[y,t] = step(sys) [y,tOut] = step(sys) also returns a vector of times tOut corresponding to the responses in y. If you do not provide an input vector t of times, step chooses the length and time step of tOut based on the system dynamics.
[y,t] = step(sys,Tfinal) [y,tOut] = step(sys,tFinal) computes the step response up to the end time tFinal. step chooses the time step of tOut based on the system dynamics.
[y,t,x] = step(sys) [y,t,x] = step(sys) also returns the state trajectories x, when sys is a state-space model such as an ss or idss model.
[y,t,x,ysd] = step(sys) [y,t,x,ysd] = step(sys) also computes the standard deviation ysd of the step response y, when sys is an identified model such as an idss, idtf, or idnlarx model.

[___] = step(___,opts)

[___] = step(___,opts) specifies additional options for computing the step response, such as the step amplitude or input offset. Use stepDataOptions to create the option set opts. You can use opts with any of the previous input-argument and output-argument combinations.

Matlab Command For the Transfer Functions :

  • For the motor load transfer function is -

G = Km / (Ts+1)

where, Km =1.25

T = 0.1

Solution -

G = 1.25 / (0.1s + 1)

G = 1.25 / 0.1(s+10)

G = 12.5 / (s+10)

Here,

Zeros = -

Poles = -10

Gain = 12.5

Commands for Transfer Fuction and Pole Zero Map in Matlab :

Commands for Pole Zero Gain Fuction in Matlab :

Commands for Step Response Plot in Matlab :

  • G(s) = (1+0.02s) (1+0.025s) / [s3 (1+0.005s) (1+0.001s)]

Numerator -

(1+0.02s) (1+0.025s) = 0.0005s2 + 0.045s + 1

Denominator -

[s3 (1+0.005s) (1+0.001s)] = 0.000005s5 + 0.006s4 + 1s3

Here,

Zeros = [-50 -40]

Poles = [-1000 -200 0 0 0]

Gain = 1000

Commands for Transfer Fuction and Pole Zero Map in Matlab :

Commands for Pole Zero Gain Fuction in Matlab :

Commands for Step Response Plot in Matlab :

Commands for Determine Pole Zero Gain values in Matlab :

STUDY - 2 :

Closed Loop Step Response using MATLAB Commands

In the first step, the equation is rearranged and the coefficients are taken for the transfer function representation :

Given Equation -

G(s) = [30(s2 - 5s + 3)] / [(s+1) (s+2) (s+4) (s+5)]

Numerator -

30(s2 - 5s + 3) = 30s2 - 150s + 90

Denominator -

(s+1) (s+2) (s+4) (s+5) = s4 + 12s3 + 49s2 + 78s + 40

Feedback Equation -

H = (30s2 - 150s + 90) / (s4 + 12s3 + 79s2 - 72s + 130)

The coefficients of S are taken in the descending Power of S and it used in TF command in Matlab.

Matlab Code For System (Without Feedback) :

Output Plot :

Peak response :

  • The Peak response reaches a maximum of around 2.25 amplitude.

Settling time :

  • From the above graph, it is clear that the plot reaches the settling time of 5.85 sec (approx). After the settling time, the response tries to follow the unit step. There will be no shoot out or sudden decrease after the settling time.

Rise Time :

  • The Rise time is the time required to reach 90% of amplitude from 10% amplitude. Here in this plot, we can observe that the rise time is 2.42 sec.

Matlab Code For System (With Feedback) :

Output Plot :

  • With the feedback, the system found to be unstable and it is difficult to found the characteristic points.
  • Using PID tune command in Matlab we can optimize the system to be more stable.

STUDY - 3 :

MATLAB Model of Single Loop Feedback / Prefilter Compensator Design :

  • In the above-given Engine Speed control model, all the blocks are connected in series.
  • The major blocks are speed reference, PID Controller, Throtttle&manifold, Power stroke, Combustion, Drag torque, Vehicle Dynamics, and finally output.
  • A Feedback loop is also present in the system which measures the output speed and gives feedback again to the PID controller.
  • In the model, an additional scope is attached to the input reference speed in order to view the input speed.

Throttle & Manifold Subsystem :

  • The throttle block takes three inputs which include throttle flow(throttle angle), a manifold pressure from the intake manifold, and an atmospheric pressure of 1 bar.
  • Inside the throttle block, it performs a series of calculations to find the output throttle flow, and this value is sent to the engine intake manifold along with the engine speed to obtain the air charge which is given to the power stroke block and manifold pressure which is feedback to the throttle block.
  • The power stroke delay block takes the air charge and the speed (final output) as feedback to provide a certain delay to the input.

Induction to Power Stroke Delay and Combustion Subsystem :

  • The power stroke delay block takes the air charge and the speed (final output) as feedback to provide a certain delay to the input.

Combustion :

  • The air charge value is converted into the fuel terms with the use of stoichiometric fuel constant along with the feedback used to find the engine torque.

Vehicle Dynamic Subsystem :

  • From the engine torque, the load torque is subtracted and this value is divide by the inertia and is feed to the integrator block.
  • The integration is done in order to find the value of engine speed.
  • The output speed and this calculated speed is given as input to the PID controller.
  • The PID controller controls the speed of the engine with the help of the reference speed given as input in the form of a step function.

PID Non-Tuned response :

  • The speed control model is opened and using the default values the model is simulated.

  • These are the default values in the PID controller for this model.

Output Plots :

Speed Reference Plot :

  • The below image is the output of the input reference speed.

Without Tuning Output Plot :

  • The rise time is high which indicates that the response time to react according to the input response is high.
  • From the above-mentioned figure, it shows clearly that at 2sec the response suddenly reaches 3000 but the actual output response almost takes 5 sec to reach 3000.
  • For better operating behaviour and to react quickly and efficiently according to the input speed we need to tune the PID controller by changing the values of P, I, and D.

PID Tuned response :

  • When PID Controller Block opened there has one option to calibrate all that value suitable to the model.
  • Tune is the option that makes the output of the model very clear.

  • The value of P, I, D, and N are calibrated and inserted in their place. We can observe that the value can be changed.

With Tuning Output Plot :

  • In the PID controller block using the tune option the P, I, and D values are changed.
  • After updating the values the simulation is done and the below image is the output got after the changes in the values

  • After tuning the response time decreases rapidly and it almost tries to cope up with the input reference speed.
  • In this way, the PID controller is tuned optimally to satisfy the needs.
  • Even though a slight overshoot occurs, here we focus more on response time so we accept it.
  • For the further best response time and minimizing overshoot fine-tune is required.

STUDY - 4 :

Importance of Bode plot :

Frequency response analysis of control systems can be carried after either analytically or graphically. The various graphical techniques available for frequency analysis are

  • Bode plot

  • Root locus

  • Polar plot

  • M and N circles

  • Nichols Chart

Bode Plot :

  • Bode plots are usually drawn for the open-loop systems. From the open-loop plot, the performance and stability of the closedloop system are estimated.
  • Frequency response plots are used to determine the frequency domain, to study the stability of the systems, and adjust the gain of the system to satisfy the desired specifications.
  • In control engineering, a bode plot is the frequency response of a system represented using two sub-plots-Magnitude plot(expressing the magnitude in decibels) and the Phase plot(expressing the phase shift in degrees.).

Determine the stability of the system using Bode plot parameters :

  • The stability of a control system is defined as the ability of any system to provide a bounded output when a bounded input is applied to it. More specifically we can say that stability allows the system to reach the steady-state and remain in that state for that particular input even after variation in the parameters of the system.
  • The stability of the system using a bode plot can be expressed in terms of gain margin and phase margin.

Gain Margin :

  • Greater will be the gain margin greater will be the stability of the system. It refers to the amount of gain, which can be increased or decreased without making the system unstable. It usually expressed n db.

Phase Margin :

  • Greater will be the phase margin greater will be the stability of the system. It refers to the phase which can be increased or decreased without making the system unstable. It usually expressed in degree.

Bode Stability Criterion :

The stability conditions are given below -

  • For a Stable System : Both the margins should be positive or the phase margin should be greater than the gain margin for the system to be stable.

  • For Marginal Stable System : Both the gain and phase margins should be zero or the phase margin should be equal to the gain margin then the system is said to be marginally stable.

  • For Unstable System : If either of the phase margin or gain margin is negative or the phase margin is less than the gain margin then the system is unstable.

Advantages of a Bode Plot :

  • It is based on the asymptotic approximation, which provides a simple method to plot the logarithmic magnitude curve.
  • The multiplication of various magnitude appears in the transfer function can be treated as an addition, while division can be treated as subtraction as we are using a logarithmic scale.
  • With the help of this plot, we can directly comment on the stability of the system without doing any calculations.
  • Bode plots provide relative stability in terms of gain margin and phase margin.
  • It also covers from low frequency to high-frequency range.

Bode plot of Transfer function in Matlab :

  • G(s) = 1 / (1+s) (1+2s)

G(s) = 1 / (2s2 + 3s + 1)

Commands for Bode plot in Matlab :

  • H(s) = 1 / s (1+s) (1+2s)

H(s) = 1 / (2s3 + 3s2 + s)

Commands for Bode plot in Matlab :

  • K(s) = 10 / s (1+0.5s) (1+0.01s)

K(s) = 10 / (0.005s3 + 0.51s2 + s)

Commands for Bode plot in Matlab :

  • J(s) = 75 (1 + 0.2s) / s2 (s + 16s + 100)

J(s) = 15s + 75 / (17s3 + 100s2)

Commands for Bode plot in Matlab :

CONCLUSION :

  • Successfully Plot the transfer function, pole-zero-gain and step response using Matlab Commands and also Determine the closed loop step response using MATLAB commands.
  • Discussed about the MATLAB Model of Single Loop Feedback / Prefilter Compensator Design .
  • Successfully Completed Bode Plot of the transfer functions using Matlab Commands and also Determine the phase and gain margin, gain and phase crossover frequency.

REFERENCES :

https://skill-lync.com/knowledgebase/how-does-a-bode-plot-determine-the-stability-of-a-system

https://in.mathworks.com/help/control/ref/lti.margin.html

The abovementioned article is referred to as the study of the Bode plot.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.