spectrum.m
SYNTAX: [spectrum_d,spectrum_f]=spectrum(data_vec,time_vec,...
zero_fill,sample_check)
PURPOSE: calculate spectrum of (uniformly sampled) data
INPUT:
data_vec = data vector to calculate spectrum for
time_vec = corresponding time vector
zero_fill = number of samples to fill out to with zeros (optional)
sample_check= set=0 to turn off checking for uniform sampling (optional)
OUTPUT:
spectrum_d = spectrum data - fft divided by number of input samples
spectrum_f = spectrum frequencies in Hz
(frequency corresp. to each data sample)
RESTRICTIONS:
METHOD: The computed spectrum is normalized so that when a cosine wave
signal is processed, a spectrum s(f) is produced with
s(f0)+conj(s(-f0)) = amplitude of cosine wave, and phase
approximately=0, where f0 is the frequency of the cosine wave
Dependencies