PDA

View Full Version : Matlab low pass filter


blue_raver22
Oct5-04, 11:34 PM
can anybody help me design a low pass filter in matlab? its a simple task but i still have trouble filtering a wav file taken by recording using the sound card. i cant seem to get it right since the length of the input is variable... can anyone show me the right way to make a filter? thanks! i am bewildered! :confused:

theCandyman
Oct8-04, 02:00 AM
I recently had to filter a sound file as homework, here the code for the high pass filter we were given. Hope it helps, I will try to help later if you need it.


function filter = hiPass(f, m)
% build a high pass filter cutting off at item f of m/2
n = m/2;
flt = [zeros(1,f-1) 0.5 ones(1,n-f)];
for index = 1:10
flt(f-index) = flt(f-index+1)/2;
flt(f+index) = 1 - flt(f - index);
end
filter = [flt 1 flt(end:-1:2)]'; <---note that this is inverted