Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
90 views

Lab 3 - Introduction To MATLAB: G(S) S (S + 1) (S + 2)

This document provides an introduction to MATLAB and instructions for a lab exercise on modeling and analyzing control systems using MATLAB. The lab involves entering transfer functions symbolically in MATLAB, plotting open-loop bode plots and root loci, determining gain and phase margins, simulating closed-loop step responses to determine time domain characteristics, and simulating steady-state error to a ramp input. Students are asked to model a DC motor system from a previous lab and analyze its open-loop and closed-loop bode plots.

Uploaded by

sahar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

Lab 3 - Introduction To MATLAB: G(S) S (S + 1) (S + 2)

This document provides an introduction to MATLAB and instructions for a lab exercise on modeling and analyzing control systems using MATLAB. The lab involves entering transfer functions symbolically in MATLAB, plotting open-loop bode plots and root loci, determining gain and phase margins, simulating closed-loop step responses to determine time domain characteristics, and simulating steady-state error to a ramp input. Students are asked to model a DC motor system from a previous lab and analyze its open-loop and closed-loop bode plots.

Uploaded by

sahar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Chapter 3

Lab 3 - Introduction to MATLAB


3.1 Introduction

You have probably noticed that any control problem of degree higher than two can get numerically very complex. Luckily, there are computer programs that make the task extremely ecient. The following is a brief introduction to MATLAB Program, Version 7.0.

3.2

MATLAB Basics
1 s(s + 1)(s + 2)

Now lets use MATLAB. Try to enter the transfer function: G(s) =

The easiest way to do this is to just enter it symbolically. >>s=s; >>g=tf([1],[1 3 2 0]); >>g Transfer function: H(s) = s3 1 + 3s2 + 2s

There are other variations on the ENTER command. Use the HELP function to nd out! You can invoke HELP by typing: >>help rltool >>help sisotool %SISO Design

The SISO Design Tool is a graphical user interface (GUI) that facilitates the design of compensators for single-input, single-output feedback loops. The SISO Design Tool allows you to iterate rapidly on your designs and perform the following tasks: Manipulate closed-loop dynamics using root locus techniques. Shape open-loop Bode responses. Add compensator poles and zeros. Add and tune lead/lag networks and notch lters. Inspect closed-loop responses (using the LTI Viewer). Adjust phase and gain margins. Convert models between discrete and continuous time. Importing Models into the SISO Design Tool

25

26

CHAPTER 3. LAB 3 - INTRODUCTION TO MATLAB If you type sisotool at the MATLAB prompt, an empty SISO Design Tool opens. You can import the DC motor model by selecting Import Model under the File menu. This opens the Import System Data dialog box. Impulse Response The impulse response of a dynamical model is the output signal that results when the input is an impulse, i.e., u(t) is zero for all values of t except t=0, where u(0)=1. It can be computed as in the equation following ARX, by letting t be equal to 0, 1, 2, ... and taking y(-T)=y(-2T)=0 and u(0)=1. The step response is the output signal that results from a step input, i.e., u(t) is zero for negative values of t and equal to one for positive values of t. The impulse and step responses together are called the models transient response. The frequency response of a linear dynamic model describes how the model reacts to sinusoidal inputs. If we let the input u(t) be a sinusoid of a certain frequency, then the output y(t) will also be a sinusoid of this frequency. The amplitude and the phase (relative to the input) will, however, be dierent. This frequency response is most often depicted by two plots; one that shows the amplitude change as a function of the sinusoids frequency and one that shows the phase shift as function of frequency. This is known as a Bode plot. Zeros and Poles The zeros and the poles are equivalent ways of describing the coecients of a linear dierence equation like the ARX model. The poles relate to the output-side and the zeros relate to the input-side of this equation. The number of poles (zeros) is equal to the number of sampling intervals between the most and least delayed output (input). In the ARX example in the beginning of this section, there are consequently two poles and one zero. SISOTOOL(G) species the plant model G to be used in the SISO Tool. Here G is any linear model created with TF, ZPK, or SS. SISOTOOL(G,C) further species an initial value for the compensator C. Similarly, SISOTOOL(G,C,H,F) supplies additional models for the sensor H and the prelter F. SISOTOOL(VIEWS) or SISOTOOL(VIEWS,G,...) species the initial conguration of the SISO Tool. VIEWS can be any of the following strings (or combination thereof): rlocus %Root locus plot bode %Bode diagram of the open-loop response nichols %Nichols plot of the open-loop response filter %Bode diagram of the prefilter F For example sisotool({nichols,bode}) Opens a SISO Design Tool showing the Nichols plot and the open-loop Bode Diagram. You can also use an extra argument OPTIONS (structure) to specify any of the following options: OPTIONS.Location %Location of C (forward for forward path,feedback for return path) OPTIONS.Sign %Feedback sign (-1 for negative, +1 for positive) See also LTIVIEW, RLOCUS, BODE, NICHOLS.

3.3. PROCEDURE

3.3

Procedure

27

1. Run through the tutorial given above. Do not turn in anything from the tutorial for the lab report. Perform the following procedure in MATLAB. You do not have to obtain a hardcopy for everything, we indicate where we want printouts. 2. Enter the transfer function: G(s) = 1 s(s + 1)(s + 2)

3. Plot the bode plot for the open-loop system and determine the phase margin. Obtain a hardcopy. 4. Plot the root locus and use the cursor function to determine the gain at which the damping ratio (zeta) of the dominant poles is 0.6. For what range of gain will the system remain stable? Obtain a hardcopy. Use CTRL-arrows to move faster, and x to change cursor in root locus graph. (k is the gain) 5. Now create a gain compensated system by multiplying the transfer function G(s) by the gain found in step 4 which gives a damping ratio of 0.6. 6. Simulate the closed-loop step response of the gain compensated system from above and from the graph (use the cursor function) determine the rise time, settling time, and percent overshoot. Obtain a hardcopy from MATLAB, be sure to label your plots. 7. Simulate the steady-state error to a ramp input for the gain compensated closed loop system. (Hint, rst obtain a transfer function for the error output to a ramp input. Then simulate it using open impulse response. Calculate the steady-state error to a ramp by hand and see if it agrees with the computer. Obtain a hardcopy. 8. Using MATLAB, plot the open-loop Bode plot for your modeled motor-tach system using the parameters you determined in Lab 2 with Ka = 2. Obtain a hardcopy, nd the phase margin, and indicate it on the output plot. 9. Plot the closed-loop Bode plot for your modeled motor-tach system from Lab 2. (remember to initialize with FREQ) Use Ka = 2. Label the peaking frequency and amplitude, obtain a hardcopy.

3.4

Pre-lab

1. Calculate (by hand) the closed-loop steady-state error to a ramp for the system given in step 2 of the procedure. (Hint: Use the nal value theorem.) 2. What is meant by system type number? (Hint: See Linear Controls text.) 3. What is meant by phase margin? (Hint: See Linear Controls text.)

3.5

Report

Include answers to the following: 1. What is necessary to do to the system above to reduce the steady-state error to a ramp input? What is necessary to achieve zero steady-state error to a ramp? Explain.

You might also like