# freq

Generate a vector of frequency locations.

## Syntax

f = freq(time)

f = freq(n,fs)

f = freq(..., option)

## Inputs

`time`- A vector of equally spaced times.
`n`- The number of points in the two-sided spectrum.
`fs`- The sampling frequency.
`option`-
- 'twosided'
- Full range is produced, with 'negative' frequencies to the right of the centered Nyquist value.
- 'onesided'
- Only non-negative frequencies are created.
- 'shift'
- Full range is produced, with 'negative' frequencies to the left of the centered DC value.

## Outputs

- f
- The vector of frequencies.

## Examples

Example with time vector:

`f = freq([0:0.001:0.009])`

```
f = [Matrix] 1 x 10
0 100 200 300 400 500 600 700 800 900
```

Example with sampling frequency and 'shift' option
specified:

`f = freq(10,1000,'shift')`

```
f = [Matrix] 1 x 10
-500 -400 -300 -200 -100 0 100 200 300 400
```

## Comments

freq is typically used to create x axis values for a plot with FFT related frequency domain data. The most common y dimensions are FFT magnitudes and PSD values.

For an odd number of points, the Nyquist frequency falls between two other values and is not contained in the output.

For an even number of points, the 'shift' option regards the Nyquist frequency as a negative value. This is for consistency with fftshift.

For the 'onesided' option, the number of output points will be
fix(`n`/2+1), and `n` otherwise.