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

`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 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 positions the Nyquist frequency as the first value, thus making it negative. This is for consistency with fftshift.