function [s] = miso_filter_lev(N,srate,rat,z)
%MISO_FILTER_LEV(N,srate,z) uses miso_firlev to get levinson
% FIR Wiener filter of order N-1, using impulse response of
% N/srate. z is a structure gotten from the get_data function.
% z(end) is the signal which is filtered using z(i) for all i.
% 'rat' is the fraction of z which will be put into filter
% funtion. The data from z is downsampled using srate and
% detrended. Let rat=1. I don't have that part working yet.
%get_mic_data gets data for'C1:IOO-MC_F', 'C1:PEM-AS_MIC,
% Example: z = get_mic_data('now',120,60)
% start time is 't- d_t' so d_t should be given in seconds. t should be given
% as a number like 893714452. d is duration in seconds. get_mic_data saves
% data to a file in current directory named 'temp_mic'. You will be asked to
% save file as 'mic_(start_time)_(duration)'.
duration = d;
function[r] = do_all_time_lev(n,t0,int,duration,N,srate,rat,order,time,MC_L,MC_F,sample_rate)
%do_all_time explores how filter performance changes with time, sample rate,
%and order of filter. Outputs data,noise estimate, structure of max
%rms error and other info. It uses get_data, miso_filter_lev, and miso_filter_int and retrives
%MC_Ldata or MC_Fdata for multiple times, calculates a miso_filter for initial-time data
%file, applies filter to the other data files, and keeps track of the...
%max(rms(residual)) for each filter. n+1 is number of data files. int is time interval between
%data files, t0 is start time, duration is duration of each data file, srate
%is the sample rate for which filter is calculated, n_N is number of orders
%of the filter you want the program to calculate,int_N is interval by which N
function[r] = do_all_plot(r,x,v)
%do_all_plot plots variables contained in r(structure from
%do_all_time_lev).Plots error(r.B.y) vs x. x can be
%'s'(srate),'N'(order),'t'(time),'p'(impulse response). v can be 's','N','t'.
%example: do_all_plot(r,'s','t') makes a plot of error vs srate for
function [s] = miso_filter_int(s,y)
%miso_filter_int inputs a filter and a structure array of data sets y, applies filter to data, and
%outputs a structure with fields: ppos(signal frequ spectrum),perr(cost
%function frequ spectrum),pest(signal estimate frequency
%data file for which filter has been calculated is s (obtained using miso_filter).
%y consists of data structures which will be filtered using
%filter from s. Then the power spectrum of the difference between signal and filtered-data is
%graphed for all the data files of y for comparison too see how well filter performs
%over time. Note if you want to create a y, take z1,z2,z3,etc. structures