k-Wave Toolbox |

# spectrum

Compute the single sided amplitude and phase spectrums

## Syntax

    [f func_as] = aspect(func, Fs)
    [f func_as] = aspect(func, Fs, ...)
    [f func_as func_ps] = aspect(func, Fs)
    [f func_as func_ps] = aspect(func, Fs, ...)

## Description

`filterTimeSeries` computes the single sided amplitude and phase spectrums of an abritrary one-dimensional input signal. For example, running the commands

    Fs = 10e6;          % [Hz]
    dt = 1/Fs;          % [s]
    t = 0:dt:1000*dt;   % [s]
    signal = 10*sin(0.5e6*2*pi*t) + 5*sin(1e6*2*pi*t) + 2*sin(2.5e6*2*pi*t);
    spectrum(signal, Fs, 'Plot', [true false]);

will produce the following amplitude spectrum.

## Inputs

`func` | signal to analyse
`Fs` | sampling frequency [Hz]

## Optional Inputs

Optional 'string', value pairs that may be used to modify the default computational settings.

Input | Valid Settings | Default | Description
--- | --- | --- | ---
`'PowerTwo'` | (boolean scalar) | `false` | Boolean controlling whether the FFT length is forced to be the next highest power of 2.
`'Plot'` | (boolean scalar or two element vector) | `false` | Boolean controlling whether the amplitude and phase spectrums are plotted. Can be given as a two element array to control the display of the amplitude and phase spectrums, respectively.
`'Unwrap'` | (boolean scalar) | `false` | Boolean controlling whether the phase spectum is unwrapped.
`'Window'` | (boolean scalar) | `false` | Boolean controlling the internal use of a Hanning window before the FFT is taken.

## Outputs

`f` | frequency array
`func_as` | single sided amplitude spectrum
`func_ps` | single sided phase spectrum

## Examples

- Filtering A Delta Function Input Signal

## See Also

`smooth`, `filterTimeSeries`

© 2009, 2010 Bradley Treeby and Ben Cox.