This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

High-pass filter [code]

Hello,
I'm a student of Technical University. I really need a code for high-pass filter to my lesson.
I have been searching in the whole net, but i didn't find. It would be great if u could help.
Thanks !
info:
Keil uVision4
c330

Parents
  • Thx for ur opionos, I undermentioned some code, is it correct? Can I somehow upgrade it ? :>

    #if HIGH_PASS

    {

    float RC = 1.0/(CUTOFF*2*3.14);

    float dt = 1.0/SAMPLE_RATE;

    float alpha = RC/(RC + dt);

    float filteredArray[numSamples];

    filteredArray[0] = data.recordedSamples[0];

    for (i = 1; i<numSamples; i++)

    {

    filteredArray[i] = alpha * (filteredArray[i-1] + data.recordedSamples[i] -

    data.recordedSamples[i-1]);

    }

    data.recordedSamples = filteredArray;

    }

    #endif

Reply
  • Thx for ur opionos, I undermentioned some code, is it correct? Can I somehow upgrade it ? :>

    #if HIGH_PASS

    {

    float RC = 1.0/(CUTOFF*2*3.14);

    float dt = 1.0/SAMPLE_RATE;

    float alpha = RC/(RC + dt);

    float filteredArray[numSamples];

    filteredArray[0] = data.recordedSamples[0];

    for (i = 1; i<numSamples; i++)

    {

    filteredArray[i] = alpha * (filteredArray[i-1] + data.recordedSamples[i] -

    data.recordedSamples[i-1]);

    }

    data.recordedSamples = filteredArray;

    }

    #endif

Children
No data