frdfun
Apply a function to the frequency response value at each frequency of an
frd model object
Syntax
Description
Examples
For this example, create a frequency response data model by computing the response of a transfer function on a grid of frequencies. For this example, assume a set of 10 frequencies.
H = tf([-1.2,-2.4,-1.5],[1,20,9.1]); w = logspace(-2,3,10); sys = frd(H,w)
sys =
Frequency(rad/s) Response
---------------- --------
0.0100 -0.1648 + 9.847e-04i
0.0359 -0.1644 + 3.508e-03i
0.1292 -0.1597 + 1.130e-02i
0.4642 -0.1294 + 9.857e-03i
1.6681 -0.1058 - 7.515e-02i
5.9948 -0.1883 - 3.050e-01i
21.5443 -0.7004 - 5.495e-01i
77.4264 -1.1337 - 2.623e-01i
278.2559 -1.1946 - 7.725e-02i
1000.0000 -1.1996 - 2.159e-02i
Continuous-time frequency response.
Model Properties
sys is a SISO frequency response data (frd) model containing the frequency response at 10 frequencies.
Use the frdfun command to apply the function imag on the frd model sys to obtain the imaginary parts of the frequency response as a function of frequency.
sysImag = frdfun(@imag,sys)
sysImag =
Frequency(rad/s) Response
---------------- --------
0.0100 9.847e-04
0.0359 3.508e-03
0.1292 1.130e-02
0.4642 9.857e-03
1.6681 -7.515e-02
5.9948 -3.050e-01
21.5443 -5.495e-01
77.4264 -2.623e-01
278.2559 -7.725e-02
1000.0000 -2.159e-02
Continuous-time frequency response.
Model Properties
You can also obtain the magnitude of the frequency response of sys with the abs function.
sysMag = frdfun(@abs,sys)
sysMag =
Frequency(rad/s) Response
---------------- --------
0.0100 0.1648
0.0359 0.1644
0.1292 0.1601
0.4642 0.1298
1.6681 0.1298
5.9948 0.3585
21.5443 0.8902
77.4264 1.1637
278.2559 1.1971
1000.0000 1.1998
Continuous-time frequency response.
Model Properties
For this example, consider a 2x2 MIMO frequency response model sys that contains 100 test frequencies for each I/O pair.
Load the frd object sys from the MAT-file frdModelMIMO.mat.
load('frdModelMIMO.mat','sys') size(sys)
FRD model with 2 outputs, 2 inputs, and 100 frequency points.
Define a function to compute the magnitude of the frequency response of the second I/O pair in sys.
fun = @(h) abs(h(2,2));
Use the frdfun command to apply the function fun to the specific I/O pair in sys.
fsys = frdfun(fun,sys);
Input Arguments
Function to be applied to frd model, specified as a MATLAB function. The function fun must accept a single
matrix and return a scalar, vector, or matrix of fixed size across frequency.
Output Arguments
Version History
Introduced in R2020a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)