2

I am new to signal processing and im trying my best to figure out how to build a high pass filter then later on implement it. (in c#)

Edit: I rewrote the question with math notation,

if someting is still wrong i will try to correct it. It is my first time to write a question in math notation.

This is to learn and for my private work, no school related :P

What i don't understand is how to calculate a high pass filter, the math is from a frend that i work with everyting except the result calculation.

//MaxPeriod and MinPeriod are (2, 10)
wight = (cos(.707 * 360 / MaxPeriod) + sin(.707 * 360 / 20) - 1) / cos(.707 * 360 / 20)

"i" is the currently input and "o" is the stored calculations of previous finalResults

//High Pass calculation
result = i - (o + wight * (i - o))

//Lets all spectrala components over a period of 10 get analyzed
//It is mainly used to make the data smooth and responsive
a1 = exp(-1.414 * 3.14159 / MinPeriod)
b1 = 2 * a1 * cos(1.414 * 180 / MinPeriod)
c2 = b1
c3 = -a1 * a1
c1 = 1 - c2 - c3

prevResult and prevResult2 is the stored calculation of result.

finalResult = c1 * (result * 2) / 2 + c2 * prevResult + c3 * prevResult2
user83571
  • 31
  • 3
  • Way down vote ? if one down vote then at least say way is anyting wrongly formated or need more explination? im new here... to get a down vote witout any explination hurts. – user83571 Jul 29 '13 at 16:23
  • 3
    Just upfront, I didn't downvote you.

    It's difficult since you apparently are not looking for how to generally build a high-pass filter but by what you wrote you apparently have something specific in mind. Maybe it was a school-task or you read something somewhere and then got it somehow wrong. So maybe you should disclose your sources. But as it stands there, your question does not make sense to me. What is alpha, how is it calculated? What are you trying to do? This is not meant to be offensive.

    – jan Jul 29 '13 at 21:00
  • Lose the Python source code and use math notation. (Also, there is no need to give the actual values of your data.) Be specific in what you don't understand. The title says that you are trying to build a filter, but your code looks like you are trying to implement the filter. For starters, do you understand what filter is and how it is applied? As currently written, your question is nonsense and that is why people will downvote it. – AnonSubmitter85 Jul 29 '13 at 23:52
  • If i am not mistaken a filter is something that you apply to a signal (a set of datas) the filter will then modify the signal as it is implemented. “How a filter is applied” as a programer i can only think of the actual code but i don’t think that is what you meant. – user83571 Aug 05 '13 at 07:59
  • 1
    The simplest high-pass filter is differentiation operator, $y[n] = x[n-1] - x[n-2]$. Alternatively, you can extract the low-frequency signal using simple low-pass filters, like (FIR) $y[n] = (x[n-1] + x[n-2])/2$ or (IIR) $y[n] = (y[n-1] + x[n-1])/2.$ and turn it into a high-pass by subtracting this low-passed signal from the input! – Val Aug 05 '13 at 11:41

0 Answers0