domingo, 21 de marzo de 2010

Frequency Response

Frequency response is the measure of any system's output spectrum in response to an input signal. In the audible range it is usually referred to in connection with electronic amplifiers, microphones and loudspeakers. Radio spectrum frequency response can refer to measurements of coaxial cables, category cables, video switchers and wireless communications devices. Subsonic frequency response measurements can include earthquakes and electroencephalography (brain waves).

Frequency response requirements differ depending on the application. In high fidelity audio, an amplifier requires a frequency response of at least 20–20,000 Hz, with a tolerance as tight as ±0.1 dB in the mid-range frequencies around 1000 Hz, however, in telephony, a frequency response of 400–4,000 Hz, with a tolerance of ±1 dB is sufficient for intelligibility of speech.
Frequency response curves are often used to indicate the accuracy of electronic components or systems. When a system or component reproduces all desired input signals with no emphasis or attenuation of a particular frequency band, the system or component is said to be "flat", or to have a flat frequency response curve.

Frequency response of a low pass filter with 6 dB per octave or 20 dB per decade

The frequency response is typically characterized by the magnitude of the system's response, measured in decibels (dB), and the phase, measured in radians, versus frequency. The frequency response of a system can be measured by applying a test signal, for example:

· applying an impulse to the system and measuring its response (see impulse response)

· sweeping a constant-amplitude pure tone through the bandwidth of interest and measuring the output level and phase shift relative to the input

· applying a signal with a wide frequency spectrum (for example digitally-generated maximum length sequence noise, or analog filtered white noise equivalent, like pink noise), and calculating the impulse response by deconvolution of this input signal and the output signal of the system.

These typical response measurements can be plotted in two ways: by plotting the magnitude and phase measurements to obtain a Bode plot or by plotting the imaginary part of the frequency response against the real part of the frequency response to obtain a Nyquist plot.

Once a frequency response has been measured (e.g., as an impulse response), providing the system is linear and time-invariant, its characteristic can be approximated with arbitrary accuracy by a digital filter. Similarly, if a system is demonstrated to have a poor frequency response, a digital or analog filter can be applied to the signals prior to their reproduction to compensate for these deficiencies.

Frequency response measurements can be used directly to quantify system performance and design control systems. However, frequency response analysis is not suggested if the system has slow dynamics.
Frecuency Response of system

Systems are analyzed in the time domain by using convolution. A similar analysis can be done in the frequency domain. Using the Fourier transform, every input signal can be represented as a group of cosine waves, each with a specified amplitude and phase shift. Likewise, the DFT can be used to represent every output signal in a similar form. This means that any linear system can be completely described by how it changes the amplitude and phase of cosine waves passing through it. This information is called the system's frequency response. Since both the impulse response and the frequency response contain complete information about the system, there must be a one-to-one correspondence between the two. Given one, you can calculate the other. The relationship between the impulse response and the frequency response is one of the foundations of signal processing: A system's frequency response is the Fourier Transform of its impulse response. Figure 9-6 illustrates these relationships.
Keeping with standard DSP notation, impulse responses use lower case variables, while the corresponding frequency responses are upper case. Since h[ ] is the common symbol for the impulse response, H[ ] is used for the frequency response. Systems are described in the time domain by convolution, that is: x[n] ∗ h[n] = y[n]. In the frequency domain, the input spectrum is multiplied by the frequency response, resulting in the output spectrum. As an equation: X[f] × H[f] = Y[f]. In other words, convolution in the time domain corresponds to multiplication in the frequency domain.
Figure 9-7 shows an example of using the DFT to convert a system's impulse response into its frequency response. Figure (a) is the impulse response of the system. Looking at this curve isn't going to give you the slightest idea what the system does. Taking a 64 point DFT of this impulse response produces the frequency response of the system, shown in (b). Now the function of this system becomes obvious, it passes frequencies between 0.2 and 0.3, and rejects all others. It is a band-pass filter. The phase of the frequency response could also be examined; however, it is more difficult to interpret and lessinteresting. It will be discussed in upcoming chapters.
Figure (b) is very jagged due to the low number of samples defining the curve. This situation can be improved by padding the impulse response with zeros before taking the DFT. For example, adding zeros to make the impulse response 512 samples long, as shown in (c), results in the higher resolution frequency response shown in (d).

How much resolution can you obtain in the frequency response? The answer is: infinitely high, if you are willing to pad the impulse response with an infinite number of zeros. In other words, there is nothing limiting the frequency resolution except the length of the DFT. This leads to a very important concept. Even though the impulse response is a discrete signal, the corresponding frequency response is continuous. An N point DFT of the impulse response provides N/2 + 1 samples of this continuous curve. If you make the DFT longer, the resolution improves, and you obtain a better idea of what the continuous curve looks like. Remember what the frequency response represents: amplitude and phase changes experienced by cosine waves as they pass through the system. Since the input signal can contain any frequency between 0 and 0.5, the system's frequency response must be a continuous curve over this range.

This can be better understood by bringing in another member of the Fourier transform family, the Discrete Time Fourier Transform (DTFT). Consider an N sample signal being run through an N point DFT, producing an N/2 + 1 sample frequency domain. Remember from the last chapter that the DFT considers the time domain signal to be infinitely long and periodic. That is, the N points are repeated over and over from negative to positive infinity. Now consider what happens when we start to pad the time domain signal with an ever increasing number of zeros, to obtain a finer and finer sampling in the frequency domain. Adding zeros makes the period of the time domain longer, while simultaneously making the frequency domain samples closer together.
Now we will take this to the extreme, by adding an infinite number of zeros to the time domain signal. This produces a different situation in two respects. First, the time domain signal now has an infinitely long period. In other words, it has turned into an aperiodic signal. Second, the frequency domain has achieved an infinitesimally small spacing between samples. That is, it has become a continuous signal. This is the DTFT, the procedure that changes a discrete aperiodic signal into a frequency domain that is a continuous curve. In mathematical terms, a system's frequency response is found by taking the DTFT of its impulse response. Since this cannot be done in a computer, the DFT is used to calculate a sampling of the true frequency response. This is the difference between what you do in a computer (the DFT) and what you do with mathematical equations (the DTFT).

The frequency response of a system can be viewed two different ways:

Via the Bode plot or via the Nyquist diagram. Both methods display the same information; the difference lies in the way the information is presented. We will study both methods in this tutorial.

The frequency response is a representation of the system's response to sinusoidal inputs at varying frequencies. The output of a linear system to a sinusoidal input is a sinusoid of the same frequency but with a different magnitude and phase. The frequency response is defined as the magnitude and phase differences between the input and output sinusoids. In this tutorial, we will see how we can use the open-loop frequency response of a system to predict its behavior in closed-loop.

To plot the frequency response, we create a vector of frequencies (varying between zero or "DC" and infinity) and compute the value of the plant transfer function at those frequencies. If G(s) is the open loop transfer function of a system and w is the frequency vector, we then plot G(j*w) vs. w. Since G(j*w) is a complex number, we can plot both its magnitude and phase (the Bode plot) or its position in the complex plane (the Nyquist plot).

Bode Plots

As noted above, a Bode plot is the representation of the magnitude and phase of G(j*w) (where the frequency vector w contains only positive frequencies). To see the Bode plot of a transfer function, you can use the Matlab bode command. For example,

bode(50,[1 9 30 40])
displays the Bode plots for the transfer function:

50 / (s^3 + 9 s^2 + 30 s + 40)

Please note the axes of the figure. The frequency is on a logarithmic scale, the phase is given in degrees, and the magnitude is given as the gain in decibels.

Note: a decibel is defined as 20*log10 ( |G(j*w| )

Gain and Phase Margin
Let's say that we have the following system:

Where K is a variable (constant) gain and G(s) is the plant under consideration. The gain margin is defined as the change in open loop gain required to make the system unstable. Systems with greater gain margins can withstand greater changes in system parameters before becoming unstable in closed loop.

The unity gain in magnitude is equal to a gain of zero in dB.

The phase margin is defined as the change in open loop phase shift required to make a closed loop system unstable.

The phase margin also measures the system's tolerance to time delay. If there is a time delay greater than 180/Wpc in the loop (where Wpc is the frequency where the phase shift is 180 deg), the system will become unstable in closed loop. The time delay can be thought of as an extra block in the forward path of the block diagram that adds phase to the system but has no effect the gain. That is, a time delay can be represented as a block with magnitude of 1 and phase w*time_delay (in radians/second).

For now, we won't worry about where all this comes from and will concentrate on identifying the gain and phase margins on a Bode plot:

The phase margin is the difference in phase between the phase curve and -180 deg at the point corresponding to the frequency that gives us a gain of 0dB (the gain cross over frequency, Wgc). Likewise, the gain margin is the difference between the magnitude curve and 0dB at the point corresponding to the frequency that gives us a phase of -180 deg (the phase cross over frequency, Wpc).

One nice thing about the phase margin is that you don't need to replot the Bode in order to find the new phase margin when changing the gains. If you recall, adding gain only shifts the magnitude plot up. This is the equivalent of changing the y-axis on the magnitude plot. Finding the phase margin is simply the matter of finding the new cross-over frequency and reading off the phase margin. For example, suppose you entered the command bode(50,[1 9 30 40]). You will get the following bode plot:

You should see that the phase margin is about 100 degrees. Now suppose you added a gain of 100, by entering the command bode(100*50,[1 9 30 40]). You should get the following plot (note I changed the axis so the scale would be the same as the plot above, your bode plot may not be exactly the same shape, depending on the scale used):

As you can see the phase plot is exactly the same as before, and the magnitude plot is shifted up by 40dB (gain of 100). The phase margin is now about -60 degrees. This same result could be achieved if the y-axis of the magnitude plot was shifted down 40dB. Try this, look at the first Bode plot, find where the curve crosses the -40dB line, and read off the phase margin. It should be about -60 degrees, the same as the second Bode plot.
We can find the gain and phase margins for a system directly, by using Matlab. Just enter the margin command. This command returns the gain and phase margins, the gain and phase cross over frequencies, and a graphical representation of these on the Bode plot. Let's check it out:
margin(50,[1 9 30 40])

Bandwidth Frequency

The bandwidth frequency is defined as the frequency at which the closed-loop magnitude response is equal to -3 dB. However, when we design via frequency response, we are interested in predicting the closed-loop behavior from the open-loop response. Therefore, we will use a second-order system approximation and say that the bandwidth frequency equals the frequency at which the open-loop magnitude response is between -6 and - 7.5dB, assuming the open loop phase response is between -135 deg and -225 deg. For a complete derivation of this approximation, consult your textbook.
If you would like to see how the bandwidth of a system can be found mathematically from the closed-loop damping ratio and natural frequency, the relevant equations as well as some plots and Matlab code are given on our Bandwidth Frequency page.
In order to illustrate the importance of the bandwidth frequency, we will show how the output changes with different input frequencies. We will find that sinusoidal inputs with frequency less than Wbw (the bandwidth frequency) are tracked "reasonably well" by the system. Sinusoidal inputs with frequency greater than Wbw are attenuated (in magnitude) by a factor of 0.707 or greater (and are also shifted in phase).
Let's say that we have the following closed-loop transfer function representing a system:

1 / (s^2 + 0.5 s + 1)
First of all, let's find the bandwidth frequency by looking at the Bode plot:
bode (1, [1 0.5 1 ])

Since this is the closed-loop transfer function, our bandwidth frequency will be the frequency corresponding to a gain of -3 dB. looking at the plot, we find that it is approximately 1.4 rad/s. We can also read off the plot that for an input frequency of 0.3 radians, the output sinusoid should have a magnitude about one and the phase should be shifted by perhaps a few degrees (behind the input). For an input frequency of 3 rad/sec, the output magnitude should be about -20dB (or 1/10 as large as the input) and the phase should be nearly -180 (almost exactly out-of-phase). We can use the lsim command to simulate the response of the system to sinusoidal inputs.

First, consider a sinusoidal input with a frequency lower than Wbw. We must also keep in mind that we want to view the steady state response. Therefore, we will modify the axes in order to see the steady state response clearly (ignoring the transient response).

w= 0.3;
num = 1;
den = [1 0.5 1 ];
u = sin(w*t);
[y,x] = lsim(num,den,u,t);

Note that the output (blue) tracks the input (purple) fairly well; it is perhaps a few degrees behind the input as expected.

However, if we set the frequency of the input higher than the bandwidth frequency for the system, we get a very distorted response (with respect to the input):

w = 3;
num = 1;
den = [1 0.5 1 ];
u = sin(w*t);
[y,x] = lsim(num,den,u,t);
axis([90, 100, -1, 1])

Again, note that the magnitude is about 1/10 that of the input, as predicted, and that it is almost exactly out of phase (180 degrees behind) the input. Feel free to experiment and view the response for several different frequencies w, and see if they match the Bode plot.

Closed-loop performance
In order to predict closed-loop performance from open-loop frequency response, we need to have several concepts clear:

The system must be stable in open loop if we are going to design via Bode plots.
If the gain cross over frequency is less than the phase cross over frequency(i.e. Wgc <>
For second-order systems, the closed-loop damping ratio is approximately equal to the phase margin divided by 100 if the phase margin is between 0 and 60 deg. We can use this concept with caution if the phase margin is greater than 60 deg.
For second-order systems, a relationship between damping ratio, bandwidth frequency and settling time is given by an equation described on the bandwidth page.
A very rough estimate that you can use is that the bandwidth is approximately equal to the natural frequency.
Let's use these concepts to design a controller for the following system:

Where Gc(s) is the controller and G(s) is:
10 / (1.25s + 1)

The design must meet the following specifications:
• Zero steady state error.
• Maximum overshoot must be less than 40%.
• Settling time must be less than 2 secs.
There are two ways of solving this problem: one is graphical and the other is numerical. Within Matlab, the graphical approach is best, so that is the approach we will use. First, let's look at the Bode plot. Create an m-file with the following code:
num = 10;
den = [1.25,1];
bode(num, den)

There are several several characteristics of the system that can be read directly from this Bode plot. First of all, we can see that the bandwidth frequency is around 10 rad/sec. Since the bandwidth frequency is roughly the same as the natural frequency (for a second order system of this type), the rise time is 1.8/BW=1.8/10=1.8 seconds. This is a rough estimate, so we will say the rise time is about 2 seconds.

The phase margin for this system is approximately 95 degrees. This corresponds to a damping of PM/100=95/100=0.95. Plugging in this value into the equation relating overshoot and the damping ratio (or consulting a plot of this relation), we find that the damping ratio corresponding to this overshoot is approximately 1%. The system will be close to being overdamped.

The last major point of interest is steady-state error. The steady-state error can be read directly off the Bode plot as well. The constant (Kp, Kv, or Ka) are located at the intersection of the low frequency asymptote with the w=1 line. Just extend the low frequency line to the w=1 line. The magnitude at this point is the constant. Since the Bode plot of this system is a horizontal line at low frequencies (slope = 0), we know this system is of type zero. Therefore, the intersection is easy to find. The gain is 20dB (magnitude 10). What this means is that the constant for the error function it 10. Click here to see the table of system types and error functions. The steady-state error is 1/(1+Kp)=1/(1+10)=0.091. If our system was type one instead of type zero, the constant for the steady-state error would be found in a manner similar to the following

Let's check our predictions by looking at a step response plot. This can be done by adding the following two lines of code into the Matlab command window.

[numc,denc] = cloop(num,den,-1);

As you can see, our predictions were very good. The system has a rise time of about 2 seconds, is overdamped, and has a steady-state error of about 9%. 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. Also, the PI controller has a zero, which we can place. This gives us additional design flexibility to help us meet our criteria. Recall that a PI controller is given by:

Gc(s) = K*(s+a)/ s
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 relating overshoot and damping ratio (or consulting a plot of this relation), we find that the damping ratio corresponding to this overshoot is approximately 0.28. Therefore, our phase margin should be approximately 30 degrees. From our Ts*Wbw vs damping ratio plot, we find that Ts*Wbw ~ 21. We must have a bandwidth frequency greater than or equal to 12 if we want our settling time to be less than 1.75 seconds which meets the design specs.
Now that we know our desired phase margin and bandwidth frequency, we can start our design. Remember that we are looking at the open-loop Bode plots. Therefore, our bandwidth frequency will be the frequency corresponding to a gain of approximately -7 dB.
Let's see how the integrator portion of the PI or affects our response. Change your m-file to look like the following (this adds an integral term but no proportional term):
num = [10];
den = [1.25, 1];
numPI = [1];
denPI = [1 0];
newnum = conv(num,numPI);
newden = conv(den,denPI);
bode(newnum, newden, logspace(0,2))

Our phase margin and bandwidth frequency are too small. We will add gain and phase with a zero. Let's place the zero at 1 for now and see what happens. Change your m-file to look like the following:
num = [10];
den = [1.25, 1];
numPI = [1 1];
denPI = [1 0];
newnum = conv(num,numPI);
newden = conv(den,denPI);
bode(newnum, newden, logspace(0,2))

It turns out that the zero at 1 with a unit gain gives us a satisfactory answer. Our phase margin is greater than 60 degrees (even less overshoot than expected) and our bandwidth frequency is approximately 11 rad/s, which will give us a satisfactory response. Although satisfactory, the response is not quite as good as we would like. Therefore, let's try to get a higher bandwidth frequency without changing the phase margin too much. Let's try to increase the gain to 5 and see what happens .This will make the gain shift and the phase will remain the same.
num = [10];
den = [1.25, 1];
numPI = 5*[1 1];
denPI = [1 0];
newnum = conv(num,numPI);
newden = conv(den,denPI);
bode(newnum, newden, logspace(0,2))

That looks really good. Let's look at our step response and verify our results. Add the following two lines to your m-file:
[clnum,clden] =cloop(newnum,newden,-1);

As you can see, our response is better than we had hoped for. However, we are not always quite as lucky and usually have to play around with the gain and the position of the poles and/or zeros in order to achieve our design requirements.

The Nyquist Diagram

The Nyquist plot allows us to predict the stability and performance of a closed-loop system by observing its open-loop behavior. The Nyquist criterion can be used for design purposes regardless of open-loop stability (remember that the Bode design methods assume that the system is stable in open loop). Therefore, we use this criterion to determine closed-loop stability when the Bode plots display confusing information. The following movie will help you visualize the relationship between the Bode plot and the Nyquist diagram.
The Nyquist diagram is basically a plot of G(j* w) where G(s) is the open-loop transfer function and w is a vector of frequencies which encloses the entire right-half plane. In drawing the Nyquist diagram, both positive and negative frequencies (from zero to infinity) are taken into account. We will represent positive frequencies in red and negative frequencies in green. The frequency vector used in plotting the Nyquist diagram usually looks like this (if you can imagine the plot stretching out to infinity):

In order to see how the frequency vector contributes to the Nyquist diagram more clearly, you can view our movie.
However, if we have open-loop poles or zeros on the jw axis, G(s) will not be defined at those points, and we must loop around them when we are plotting the contour. Such a contour would look as follows:

Lenny Z Perez M

Connect to the next generation of MSN Messenger  Get it now!

No hay comentarios:

Publicar un comentario