# Routine gen_grid

Generate a frequency grid.

### Description

This routine generates a logarithmically spaced frequency grid, which is automatically refined in some frequency regions corresponding to weakly damped modes of a given LTI system.

### Syntax

grid=gen_grid(sys{,freq}) grid=gen_grid(sys{,npts}) grid=gen_grid(sys{,freq,npts})

### Input arguments

 sys LTI object. freq Frequency interval in rad/s. This argument is optional and the default value is computed according to the system bandwidth. npts Number of frequency points. This argument is optional and the default value is npts=50.

### Output argument

 grid Frequency grid.

### Example

sys=ss(mdiag([-0.1 1;-1 -0.1],[-1 10;-10 -1]),[],[],[]);damp(sys)grid=gen_grid(sys,[0 20],20)