k-Wave Toolbox |
Compute the single sided amplitude and phase spectrums
func_as = spect(func, Fs) func_as = spect(func, Fs, ...) [f, func_as] = spect(func, Fs) [f, func_as] = spect(func, Fs, ...) [f, func_as, func_ps] = spect(func, Fs) [f, func_as, func_ps] = spect(func, Fs, ...)
spect
computes the single-sided amplitude and phase spectrums of a 1, 2, or 3 dimensional input signal. If the optional input 'Dim'
is not specified, the spectrum is computed along the first non-singleton dimension. 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); spect(signal, Fs, 'Plot', [true false]);
will produce the following amplitude spectrum.
|
signal to analyse |
|
sampling frequency [Hz] |
Optional 'string', value pairs that may be used to modify the default computational settings.
Input | Valid Settings | Default | Description |
---|---|---|---|
|
(integer scalar) |
first non-singleton dimension |
Dimension over which the spectrum is computed. |
|
(integer scalar) |
signal length |
Length of the FFT. If the set length is larger than the signal length, the signal is zero padded. If the set length is smaller than the signal length, the default value is used instead. |
|
(Boolean scalar) |
|
Boolean controlling whether the FFT length is forced to be the next highest power of 2. |
|
(Boolean scalar or two element vector) |
|
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. |
|
(Boolean scalar) |
|
Boolean controlling whether the phase spectrum is unwrapped. |
|
(string) |
|
Parameter string controlling the window type used to filter the signal before the FFT is taken. Any valid input types for |
|
frequency array |
|
single sided amplitude spectrum |
|
single sided phase spectrum |
smooth
, filterTimeSeries
smooth | speedSoundWater |
© 2009-2014 Bradley Treeby and Ben Cox.