[go: up one dir, main page]

Menu

[73c35b]: / init / REC_impresp.m  Maximize  Restore  History

Download this file

36 lines (31 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
% REC_impresp.m: % defines various kinds of impulse responses
% GUISDAP v.1.60 96-05-27 Copyright Asko Huuskonen and Markku Lehtinen
%
% The possible filter types are:
% type data
% ==== ====
% 'box' gives the length of box in microseconds
% 'taps' gives the filter coefficients
% 'but' gives the bandwidth of Butterworth filter
% 'lin' gives the bandwidth of Linear Phase filter
% Output parameter: vc_p (global)
%
% See also: design, lin_filt, but_filt
%
% function REC_impresp(data,type)
function REC_impresp(data,type)
global vc_p vc_number p_dtau
if nargin==1, type='box'; end
if isstr(type)==0,
len=data/p_dtau;
impresp=(1/len)*kron(type,ones(len,1));
elseif strcmp(type,'taps')
impresp=data(:);
elseif strcmp(type,'but'), % Butterworth filter
impresp=but_filt(data);
elseif strcmp(type,'lin'), % Linear phase filter
impresp=lin_filt(data);
else % Assume Box-car filter
impresp=ones(data/p_dtau,1);
end
vc_p(1:length(impresp)+1,vc_number)=[impresp/sum(impresp);0]; % Scale to unit area