# zgrid

Generate z-plane grid of constant damping factors and natural frequencies

## Syntax

``zgrid``
``zgrid(T)``
``zgrid(zeta,wn)``
``zgrid(zeta,wn,T)``
``zgrid(___,'new')``
``zgrid(AX,___)``

## Description

example

````zgrid` generates a grid of constant damping factors from 0 to 1 in steps of 0.1 and natural frequencies from 0 to `π/T` in steps of `0.1*π/T` for root locus and pole-zero maps. The default steps of `0.1*π/T` represent fractions of the Nyquist frequencies. `zgrid` then plots the grid over the current axis. `zgrid` creates the grid over the plot without altering the current axis limits if the current axis contains a discrete z-plane root locus diagram or pole-zero map. Use this syntax to plot multiple systems with different sample times.Alternatively, you can select Grid from the context menu in the plot window to generate the same z-plane grid.```

example

````zgrid(T)` generates the z-plane grid by using default values for damping factor and natural frequency relative to the sample time `T`.```
````zgrid(zeta,wn)` plots a grid of constant damping factor and natural frequency lines for the damping factors and normalized natural frequencies in the vectors `zeta` and `wn`, respectively. When the sample time is not specified, the frequency values in `wn` are interpreted as normalized values, that is, `wn/T`.```
````zgrid(zeta,wn,T)` plots a grid of constant damping factor and natural frequency lines for the damping factors and natural frequencies in the vectors `zeta` and `wn`, relative to sample time `T`. `zeta` lines are independent for `T` but the `wn` lines depend on the sample time value. Use this syntax to create the z-plane grid with specific values of `wn`.```
````zgrid(___,'new')` clears the current axes first and sets `hold on`.```
````zgrid(AX,___)` plots the z-plane grid on the `Axes` or `UIAxes` object in the current figure with the handle `AX`. Use this syntax when creating apps with `zgrid` in the App Designer.```

## Examples

collapse all

To see the z-plane grid on the root locus plot, type

`H = tf([2 -3.4 1.5],[1 -1.6 0.8],-1)`
```H = 2 z^2 - 3.4 z + 1.5 ------------------- z^2 - 1.6 z + 0.8 Sample time: unspecified Discrete-time transfer function. ```
```rlocus(H) zgrid axis equal```

For this example, consider a discrete-time transfer function `sys` with a sample time of 0.1s. Now plot the pole-zero map of `sys` and visualize the default z-plane grid without specifying the sample time.

```sys = tf([2 -3.4 1.5],[1 -1.6 0.8],0.1); Ts = 0.1; figure() pzmap(sys) zgrid() axis equal```

Observe that the frequencies on the z-plane grid are normalized in terms of $f\frac{\pi }{T}$. To obtain the true frequency values on the grid, specify the sample time with the `zgrid` command.

```figure() pzmap(sys) zgrid(Ts) axis equal```

Now, observe that the frequency values on the plot are true values, that is, they are non-normalized.

## Input Arguments

collapse all

Damping ratio, specified as a vector in the same order as `wn`.

Natural frequency values, specified as a vector. Natural frequencies are plotted as true values when `T` is specified. When the sample time is not specified, `zgrid` normalizes the values as `wn/T`.

Sample time, specified as:

• A positive scalar representing the sampling period of a discrete-time system. The actual frequency values are displayed on the frequency grid.

• `-1` for a discrete-time system with an unspecified sample time. The frequency values are displayed as normalized values `f*π/T` for the default grid.

`zeta` lines are independent of `T` while `wn` lines are dependent on the sample time. You must specify `T` to plot specific values of `wn`. When the sample time `T` is not specified, the required `wn` values are interpreted as normalized values, that is, `wn/T`.

Object handle, specified as an `Axes` or `UIAxes` object. Use `AX` to create apps with `zgrid` in the App Designer.

## Version History

Introduced before R2006a