Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab low pass filter

  1. Oct 5, 2004 #1
    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:
  2. jcsd
  3. Oct 8, 2004 #2
    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);
    filter = [flt 1 flt(end:-1:2)]'; <---note that this is inverted
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook