# fold

Create one-sided spectrum amplitude vectors from the two-sided equivalents.

## Syntax

amp1 = fold(amp2)

amp1 = fold(amp2,dim)

## Inputs

`amp2`- Two-sided amplitudes.
`dim`- Dimension on which to perform the calculation.

## Outputs

- amp1
- One-sided amplitudes.

## Examples

Examples with even number of inputs:

`amp1 = fold([1,2,5,3,5,2])`

```
amp1 = [Matrix] 1 x 4
1 4 10 3
```

`amp1 = fold([1,2,5,3,3,5,2])`

```
amp1 = [Matrix] 1 x 4
1 4 10 6
```

## Comments

fold is only meaningful for symmetrical inputs, usually produced from real time domain signals. The positive half of the spectrum (below the Nyquist frequency) is doubled, thus effectively folding the spectrum in half.

freq with the 'onesided' option can be useful to create appropriate x-axis values.