0001 function data = vb_signal_processor_view_filter_response(data, parm)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 if ~exist('data', 'var')
0020 error('data is a required parameter.');
0021 end
0022 if ~exist('parm', 'var')
0023 error('parm is a required parameter.');
0024 end
0025
0026
0027
0028
0029 persistent freq_str;
0030 if isempty(freq_str), freq_str = ''; end
0031
0032 ret = inputdlg('Enter the sampling frequency of the data[Hz]', 'View the selected filter response', 1, {freq_str}, 'on');
0033 if ~isempty(ret)
0034 freq_str = ret{1};
0035 freq = str2double(freq_str);
0036 else
0037 return;
0038 end
0039
0040 d = vb_define_signal_processor;
0041
0042 online = 1;
0043 ftype = '';
0044 Norder = 0;
0045
0046 switch(parm.type)
0047 case {d.TYPE_PROCESSING_HIGHPASS, d.TYPE_PROCESSING_LOWPASS}
0048 fcut = parm.cutoff_freq;
0049 if parm.impulse_response == 2
0050 Norder = parm.order;
0051 end
0052 if parm.filtfilt
0053 online = 0;
0054 end
0055 if isequal(parm.type, d.TYPE_PROCESSING_HIGHPASS)
0056 ftype = 'high';
0057 else
0058 ftype = 'low';
0059 end
0060 case {d.TYPE_PROCESSING_BANDPASS, d.TYPE_PROCESSING_STOPBAND}
0061 fcut = [parm.cutoff_freq_low, parm.cutoff_freq_high];
0062 if parm.impulse_response == 2
0063 Norder = parm.order;
0064 end
0065 Norder = parm.order;
0066 if parm.filtfilt
0067 online = 0;
0068 end
0069 if isequal(parm.type, d.TYPE_PROCESSING_BANDPASS)
0070 ftype = 'band';
0071 else
0072 ftype = 'stop';
0073 end
0074 otherwise
0075 error('Unsupported filter was specified.');
0076 end
0077
0078 figure;
0079 vb_plot_filter_response(ftype, fcut, freq, Norder, [], [], online);