evalfr
Evaluate system response at specific frequency
Syntax
Description
evalfr
is a simplified version of freqresp
meant for quick evaluation of the system response at the Laplace variable value of
s
or z
for a single, specific frequency. Use freqresp
to evaluate the system response over a set of frequencies. To obtain
the magnitude and phase data as well as plots of the frequency response, use bode
instead.
Examples
Evaluate Discrete-Time Transfer Function
Create the following discrete-time transfer function.
H = tf([1 -1],[1 1 1],-1);
Evaluate the transfer function at z = 1+j
.
z = 1+j; evalfr(H,z)
ans = 0.2308 + 0.1538i
Evaluate Frequency Response of Identified Model at Given Frequency
Create the following continuous-time transfer function model:
sys = idtf(1,[1 2 1]);
Evaluate the transfer function at frequency 0.1 rad/second.
w = 0.1; s = j*w; evalfr(sys,s)
ans = 0.9705 - 0.1961i
Alternatively, use the freqresp
command.
freqresp(sys,w)
ans = 0.9705 - 0.1961i
Frequency Response of MIMO State-Space Model
For this example, consider a cube rotating about its corner with inertia tensor J
and a damping force F
of 0.2 magnitude. The input to the system is the driving torque while the angular velocities are the outputs. The state-space matrices for the cube are:
Specify the A
, B
, C
and D
matrices, and create the continuous-time state-space model.
J = [8 -3 -3; -3 8 -3; -3 -3 8]; F = 0.2*eye(3); A = -J\F; B = inv(J); C = eye(3); D = 0; sys = ss(A,B,C,D); size(sys)
State-space model with 3 outputs, 3 inputs, and 3 states.
Compute the frequency response of the system at 0.2 rad/second. Since sys
is a continuous-time model, express the frequency in terms of the Laplace variable s
.
w = 0.2; s = j*w; frsp = evalfr(sys,s)
frsp = 3×3 complex
0.3607 - 0.9672i 0.3197 - 0.5164i 0.3197 - 0.5164i
0.3197 - 0.5164i 0.3607 - 0.9672i 0.3197 - 0.5164i
0.3197 - 0.5164i 0.3197 - 0.5164i 0.3607 - 0.9672i
Alternatively, you can use the freqresp
command to evaluate the frequency response using the scalar value of the frequency directly.
H = freqresp(sys,w)
H = 3×3 complex
0.3607 - 0.9672i 0.3197 - 0.5164i 0.3197 - 0.5164i
0.3197 - 0.5164i 0.3607 - 0.9672i 0.3197 - 0.5164i
0.3197 - 0.5164i 0.3197 - 0.5164i 0.3607 - 0.9672i
Input Arguments
sys
— Dynamic system
dynamic system model | model array
Dynamic system, specified as a SISO or MIMO dynamic system model or array of dynamic system models. Dynamic systems that you can use include:
Generalized or uncertain state-space models such as
genss
oruss
(Robust Control Toolbox) models. (Using uncertain models requires Robust Control Toolbox™ software.)For tunable control design blocks, the function evaluates the model at its current value to evaluate the frequency response.
For uncertain control design blocks, the function evaluates the frequency response at the nominal value and random samples of the model.
Identified state-space models, such as
idss
(System Identification Toolbox) models. (Using identified models requires System Identification Toolbox™ software.)
For a complete list of models, see Dynamic System Models.
f
— Frequency at which to evaluate system response
complex scalar
Frequency at which to evaluate system response, expressed as the Laplace variable
s
or z
, specified as a complex scalar. Specify
the frequency in terms of the Laplace variable s
or
z
based on whether sys
is a continuous-time or
discrete-time model, respectively. For instance, if you want to evaluate the frequency
response of a system sys
at a frequency value of
w
rad/s, then specify f
in terms of
s = jw
, ifsys
is in continuous-time.z = ejwT
, ifsys
is in discrete-time. Here,T
is the sample time.
Output Arguments
frsp
— Frequency response
complex scalar
Frequency response of the system at f
, returned as a complex
scalar.
Version History
Introduced before R2006a
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
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)