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

Filter design

  1. Dec 4, 2005 #1
    I posted the details of myquestions earlier but no help. Maybe I need to rephrase it.
    I basically generated a square wave and added noise to it using Matlab.
    The question is how do I design a filter to reduce as much noise as possible to retain most of the square wave. The SNR is OdB.

    Thanks in advance
     
  2. jcsd
  3. Dec 4, 2005 #2

    berkeman

    User Avatar

    Staff: Mentor

    Sounds like a Cheby filter with ripples in the passband (or an elliptical with ripples everywhere) would work the best, with the ripples matching the spectra of the square wave (fundamental, 3rd harmonic, etc.).
     
  4. Dec 4, 2005 #3
    thanks for the help!:smile:
    How do I determine the cutoff (corner) frequency to use given the frequency of the square wave and the sampling frequency.
     
  5. Dec 5, 2005 #4

    berkeman

    User Avatar

    Staff: Mentor

    If you want to keep it simple, just use the fundamental of the square wave, and put the cutoff right above that. A little fancier is what I was mentioning, to match a Cheby/elliptical filter's ripples to the 1/f rollof of the square wave's harmonics. The best solution, though, would be to do a correlation with a square wave of the same frequency. Do you always know the frequency of the original square wave?
     
  6. Dec 5, 2005 #5

    berkeman

    User Avatar

    Staff: Mentor

    Edit -- I think a straight digital correlator design would give you the best results, if you know what the frequency of the original signal is. A digital correlator is where you have a shift register that you feed your input digitized signal into one end, and at each sample clock tick, you shift the data through the ganged registers. For each sample clock tick, you multiply each register value by some coefficient, and take the overall sum of the multiplications as the correlator output for that clock tick. To correlate against a bipolar square wave, for example, the coefficients for the first half of the ganged registers would be something like +1, and for the second half they would all be -1. The correlator is one period long for the square wave, measured in sample clock ticks.

    So when you feed in your bipolar square wave plus noise, the output of the correlator will be +A (A=amplitude of the input signal) when the input signal lines up with the square wave coefficients, and -A when it lines up opposite of the coefficients. The correlator output is not a square wave -- instead it has peaks where the correlation is max and min, and zero crossings between these peaks. To convert the correlator output back to a square wave, use the A number and the zero crossings to take your best guess at the original signal. You will get very good noise rejection by using a correlator, especially if you have lots of samples per cycle, and as many bits per sample as possible. You should be able to get well below a 0dB SNR with a good correlator design. You can do this all in MatLab, so try it out! -Mike-
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Filter design
  1. Filter Design Project (Replies: 5)

  2. Low pass filter design (Replies: 2)

Loading...