evalfr

Evaluate system response at specific frequency

Syntax

``frsp = evalfr(sys,x)``

Description

`evalfr` is a simplified version of `freqresp` meant for quick evaluation of the system response at any point in the complex plane. To evaluate system response over a set of frequencies, use `freqresp`. To obtain the magnitude and phase data as well as plots of the frequency response, use `bode`.

example

````frsp = evalfr(sys,x)` evaluates the dynamic system model `sys` at the point `x` in the complex s plane (for continuous-time `sys`) or z plane (for discrete-time `sys`) . ```

Examples

collapse all

Create the following discrete-time transfer function.

`$H\left(z\right)=\frac{z-1}{{z}^{2}+z+1}$`

`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 ```

Create the following continuous-time transfer function model:

`$H\left(s\right)=\frac{1}{{s}^{2}+2s+1}$`

`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 ```

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:

`$\begin{array}{l}A=-{J}^{-1}F,\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}B={J}^{-1},\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}C=I,\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}\phantom{\rule{0.2777777777777778em}{0ex}}D=0,\\ where,\phantom{\rule{0.2777777777777778em}{0ex}}J=\left[\begin{array}{ccc}8& -3& -3\\ -3& 8& -3\\ -3& -3& 8\end{array}\right]\phantom{\rule{0.2777777777777778em}{0ex}}and\phantom{\rule{0.2777777777777778em}{0ex}}F=\left[\begin{array}{ccc}0.2& 0& 0\\ 0& 0.2& 0\\ 0& 0& 0.2\end{array}\right]\end{array}$`

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

collapse all

Dynamic system, specified as a SISO or MIMO dynamic system model or array of dynamic system models. Dynamic systems that you can use include:

• LTI models such as `ss` (Control System Toolbox), `tf` (Control System Toolbox), and `zpk` (Control System Toolbox) models.

• Sparse state-space models, such as `sparss` (Control System Toolbox) or `mechss` (Control System Toolbox) models.

• Generalized or uncertain state-space models such as `genss` (Control System Toolbox) or `uss` (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` models.

For a complete list of models, see Dynamic System Models.

Point in complex plane at which to evaluate system response, specified as a complex scalar. For continuous-time `sys`, the point `x` is in the plane of the continuous-time Laplace variable s. For discrete-time `sys`, `x` is in the plane of the discrete-time Laplace variable z.

To evaluate the response of the system at a particular frequency, specify the frequency in terms of the appropriate Laplace variable. For instance, if you want to evaluate the frequency response of a system `sys` at a frequency value of `w` rad/s, then use:

• `x = j*w`, for continuous-time `sys`.

• `z = exp(j*w*Ts)`, for discrete-time `sys`, where `Ts` is the sample time.

Output Arguments

collapse all

Frequency response of the system at the point `x`, returned as a complex scalar (for SISO `sys`) or a complex array (for MIMO `sys`). For MIMO systems, the array dimensions correspond to the I/O dimensions of `sys`.

Version History

Introduced in R2012a