Control Tutorials
for Matlab


Numerical Solution


Let's use a numerical approach to design a controller for the following system:

Where Gc(s) is the controller and the plant transfer function G(s) is:

  10
   ----------
   1.25s + 1

The design must meet the following specifications: First, let's look at the Bode plot of the plant:
	bode(10, [1.25,1])

Now we need to choose a controller that will allow us to meet the design criteria. We choose a PI controller because it will yield zero steady state error for a step input as well as an open-loop zero that will help us meet our design criteria. Recall that a PI controller is given by:
K*(s+a) Gc(s) = ------- s
We are now ready to begin our controller design. The first thing we need to find is the damping ratio corresponding to a percent overshoot of 40%. Plugging in this value into the equation which relates overshoot to damping ratio, we find that the damping ratio corresponding to this frequency is 0.28:
	DR = -1*log(0.4)/sqrt(pi^2 +(log(0.4))^2)
		
		DR =

 			 0.2800

In order to make sure that we meet the desired specs, we will use 0.4 as our damping ratio. We use a higher damping ratio than necessary because the zero we are adding will add overshoot to our response. Now that we have our damping ratio, and therefore our phase margin, let's find our bandwidth frequency by looking at the plot that relates the damping ratio, bandwidth frequency and settling time.

From the plot, we find that Ts*Wbw ~ 14, which gives us a bandwidth frequency equal to 12 rad/sec if we want our settling time to be 1.2 seconds (making sure that we meet our design specs).

As you might recall, the open-loop bandwidth frequency (which we already know) is the frequency which yields a gain of approximately -3 dB. We will then design for a gain crossover frequency of 15 rad/sec since it will yield an even better closed-loop response (than of 12 rad/sec). Keep in mind the bandwidth frequency will be larger than the crossover frequency because the plot must cross the 0dB gain before getting to the -3dB gain. Therefore, a crossover frequency of 15 will yield a slightly faster settling time (Ts*wb = 14, this does not change). This is a reasonable approximation for second order systems.

Now that we have made all the pertinent decisions, let's find our pole and gain for the controller.The first step is to recall from the derivation of the phase margin that at the gain crossover frequency (corresponding to a gain of 0dB) the phase is equal to -180 deg plus the phase margin. Therefore, we can set up the following equation (arg translates as angle of):

-180deg + PM = arg(Gc(j*Wgc)*G(j*Wgc))
Now we can plug in our values for the phase margin and the gain crossover frequency in order to find our pole (a):
-180deg + PM = argK + arg(j*Wgc + a) + arg(1/j*Wgc) + argG(j*Wgc) -180deg + 40deg = argK + arg(12*j + a) + arg(1/12*j) + argG(12*j) -140deg = 0deg + arg(12*j + a) - 90deg -86.19deg
Let's pause for a second and see where these angles came from. The angle for the gain constant is zero simply because it is a constant. The angle for 1/j*w will always be -90 deg (use the Bode plots if you don't take our word for it). Lastly, the angle for our plant (G(s)) can be found by evaluating our transfer function at j*12 and translating polar coordinates to magnitude and phase:
	Pol = 10/polyval([1.25,1], j*12);
	Mag = abs(Pol)
	Phase = 360*atan(imag(Pol)/real(Pol))/(2*pi)
		
		Mag =
			 0.6652
		
		Phase =
			 -86.1859
Let's continue now
-140deg = 0deg + arg(12*j + a) -176.19deg 36.19deg = arg(12*j +a) 12/a = tan (36.19deg) a = 16.4
We already know the magnitude for the plant at this frequency and we can calculate the remaining magnitudes by plugging in the known variables, keep in mind that the gain for the original transfer function is 0.6652.
|K| * |j*12 - 16.4| * 0.6652 -------------------------------- = 1 |j*12| |K| = 12/(20.32 * 0.6652) K = |K| = 0.8877
Now that we have solved for our unknowns, we can model the system and see if we meet the design specs. we will need to enter the following code into the Matlab command window to view the step response for this compensated system.
	%define plant TF
	nump = 10;
	denp = [1.25 1];

	%define controller TF
	numc = 0.8877*[ 1  16.4];
	denc = [1 0];

	%find closed-loop transfer function for system described above
	olnum = conv(nump,numc);
	olden = conv(denp,denc);
	[numca,denca] = cloop(olnum,olden);
 
	%view step response
	step(numca,denca)
Our step response looks like this:

As we can see, it meets our design specifications (the green line represent the 40% Overshoot limit). If you would like to see how this system behaves if we use different damping ratios and crossover frequencies, run this m-file. We suggest you read it carefully and understand the commands that are being used.


Use your browser "Back" button to return to the previous page

8/15/96 LJO, 8/23/96 YS