inout_fresp.m
SYNTAX: fresp = inout_fresp(fresp_inputs)
PURPOSE: Calculate frequency response for a generic input/output pair of
sinusoidal signals. DC components of both signals are removed
before calculating response.
INPUT:
fresp_inputs = structure containing:
out_num = output number for output_d (use 1 if only one output)
input_d = input data vector
input_t = input time vector
output_d = output data vector or matrix (i.e., one output per column)
output_t = output time vector
max_search_f = maximum frequency - don't look for spectral peaks past this
max_plot_f = maximum frequency in plot of spectra of input/output signals
And optionally:
powerof2 = integer = some power of 2 greater than the number of samples
in either input_d or output_d, to use in fft (optional)
signal is zero filled to this number. (this speeds up fft
calculation as well as giving finer frequency sampling for
more accurate gain/phase calculation)
showplots= set>=1 to see plots used in freq response calculation, otherwise
0 (default), use a value > 1 to cause program to wait after each plot
reject_thresh = thresholds for declaring response = NaN when problems with data, e.g.
input/output frequencies don't match, or SNR of output too small
= [freq_thresh (), snr_thresh (dB)] (default = 10, 0 dB)
verbose = set > 0 to get printed diagnostic information (larger numbers => more info)
OUTPUT:
fresp = structure containing:
gain = calculated gain from input to output signal
phi = calculated phase from input to output signal (degrees)
freq = calculated frequency of input signal (output is checked also)
max_in = maximum amplitude of input signal
max_out= maximum amplitude of output signal
RESTRICTIONS:
(1) Both input and output data MUST have uniform sampling rate.
(2) Both input and output data MUST represent same time window.
Dependencies