image thumbnail

Simple Zero Phase Distortion Multiplier-less Gaussian Low-Pass & High-Pass Filter of a Linear Chirp

by

 

Simple Zero Phase Distortion Multiplier-less Gaussian Low-Pass & High-Pass Filter of a Linear Chirp.

biswas49.m
disp 'Simple Gaussian LP/HP Filter Demo'
disp 'Uploaded January 16, 2012'
disp 'Author: Amitava Biswas, PhD, FIEI, FIETE'
disp 'The University of Texas at El Paso'
disp 'Email:abiswas@utep.edu Phone:(915)747-8307'
disp 'practically zero-phase distortion'
disp 'so high pass = original - low pass'
disp 'this relation will not hold for elliptic filters'
disp 'also practically multiplier-less !!'

close all; clear all; tic % how fast is your computer?
fs=48000; % samples per second
f=10000; % final frequency of synthesized chirp test signal
t=(0:fs-1)/fs; % one second
x=sin(f*pi*t.^2)/2; % synthesize chirp linear rise 0 to f
% wavwrite(x,fs,'test.wav') % save to analyze the signal later

scrsz = get(0,'ScreenSize'); % full screen looks better
figure('Position', scrsz, 'Units', 'normalized');
axes('Position',[0 0 1 1], 'Units','normalized');
axis([0 fs -4 4]); % broad enough, change if necessary
axis on; grid on; hold on % looks ok
plot(x,'y'); % linear chirp will show frequency response
text(fs/4,3.5, ...
    'Simple Gaussian Zero-Phase Filter Demo by Amitava Biswas', ...
    'fontsize',24);
text(fs/4,0,['Original Chirp, 0 to ' ...
    num2str(f) ' Hz = (High Pass + Low Pass)'], ...
    'fontsize',24);
set(gca,'XTick',(1:4)*fs/5)
for k=1:4
    text(k*fs/5,-3,[num2str(k*f/5) ' Hz'], ...
        'fontsize',18, 'HorizontalAlignment','center')
end

xlo=x; % initialize low pass output
for k=1:8
    xlo=[0 xlo]+[xlo 0]; % from pascal's triangle to gaussian bell
    xlo=[0 xlo]+[xlo 0]; % from pascal's triangle to gaussian bell
    xlo=xlo/4; % scale to unity gain
    xlo=xlo(2:end-1); % trim to original size
    xhi=x-xlo; % luckily ok as you have zero phase distortion !!!
    plot(xlo-2,'r');
    plot(xhi+2,'g');
    text(fs/2,2,['High Pass #' num2str(k)], 'fontsize',24);
    text(fs/8,-2,['Low Pass #' num2str(k)], 'fontsize',24);
    drawnow;
    if k<8 % erase
        plot(xlo-2,'w');
        plot(xhi+2,'w');
    end
end

toc % how fast is your computer?
disp('pretty simple and fun, no?')

Contact us