For this example, use the transfer function introduced in Example 12.5:
T(s) =\frac{10}{2s + 1} .
For this example, use the transfer function introduced in Example 12.5:
T(s) =\frac{10}{2s + 1} .
Table 12.3. Summary of MATLAB sinusoidal transfer-function-related commands
Syntax | Description | Returns | Comments |
R=Evalfr (sys, w) | Evaluates frequency response of a TF object for a single frequency w | Single complex number that is the value of the TF at frequency w | Appropriate for quickly checking the response at one or a few frequencies |
H= Freqresp (sys, w) | Evaluates the frequency response of a TF object over a grid of frequencies (contained in the vector w) | A vector of complex numbers (H) that are the TF evaluated at each frequency contained in w | Generates the response for a range of user-specified frequencies |
Bode (sys) | Plots the Bode plot of a TF object. | Can return the Bode data (see help) | Generates the Bode plot |
Nyquist (sys) | Plots a polar (Nyquist) frequency-response plot of the TF object | Can return response data (see help) | Generates the polar frequency-response plot |
First, enter the transfer function as a TF object:
>>extf = tf([10], [2 1]) Transfer function: 10 2s+1
Use the evalfr command to verify entries in Table 12.2 for a frequency of 0.25 rad/s.
>>evalfr(extf, 0.25*i) ans = 8.0000 — 4.0000i
Note that the frequency passed to the function is specified as an imaginary number.
This is consistent with the interpretation that the sinusoidal transfer function is found by substituting s = jω. Note also that the result is the same that can be found in Table 12.2 for a frequency of 0.25 rad/s.
Now, use the freqresp function to generate the entire table with a single computation.
The first step is to build a vector of frequencies:
>>wex = i*[0 .1 .25 .5 1 5 10 1000]
Use the function to generate the response:
>>h=freqresp(extf,wex)
It is left to the reader to verify that the results correspond to the entries previously presented in Table 12.2.
\omega \left(rad/s\right) | 0.0 | 0.1 | 0.25 | 0.5 | 1.0 | 5.0 | 10.0 | … | \infty |
Re\left[T(j\omega )\right] | 10 | 9.62 | 8.0 | 5.0 | 2.0 | 0.10 | 0.025 | … | 0 |
Im\left[T(j\omega )\right] | 0 | −1.92 | -4.0 | −5.0 | −4.0 | -1.0 | -0.5 | … | 0 |
T(\omega ) | 10 | 9.8 | 8.94 | 7.07 | 4.47 | 1.0 | 0.5 | … | 0 |
\phi _{T}(\omega ),\deg | 0 | -11.3 | -26.6 | -45.0 | -63.4 | -84.3 | -87.1 | … | -90 |