Hi Jerry Every time I take new sample I calculate the actual value of Y[i] and save it in a Y[i] array. Since I have few memory, which is the minumum number of Y[i] that I must save? Thanks P.S. Remember that Ft = 50 Hz Sample Rate = 2.48KHz>On 7/9/2010 5:42 AM, gpezzella wrote: >> Ok I will use this notation from now >> >> I previous post (7/1/2010 3:21 AM) you wrote me the follow equation: >> <a> "y[1] = k*x[i] + (1-k)*y[i-1] that behaves like a single RC". >> >> In the day 7/8/2010 I discovery another thread that use: >> <b> "Y[i] = K * X[i] + [1-K] * Y[i-1]" >> which is coincident to yours: >> <c> "Y[i] = [ X[i] - Y[i-1] ] * K + Y[i-1]" >> >> Today instead you write that: >> <d> "Y[i] = k*Y[i-1] + (k-1)*X[i]" is the correct equation >> >> Question 1: Which is the good one between a,b,c,d? > >They are all good. Where I initially have the coefficients as k and 1-k, >your other gave them as 1-k and k. Because k is an arbitrary constant, >the two notations are equivalent. After your response, I switched to >your notation. > >> Question 2: After choose the correct equation, is the follow methodcorrect>> for calculate K coefficient? >>-------------------------------------------------------------------------------->> ts >> -(--) Where: ts = sample period (seconds) >> T T = time constant (seconds) >> (1) K = 1 - e K = change in o/p after 1 ts >> >> >> The value for K is then used as the coefficient in the RC LPF code. >> >> If the above equation is correct I should use for my case: >> 1)Ft = 50 Hz >> 2)Sample Rate = 2.48KHz >> >> >> 1 >> T = ------- = 0.00318 >> 2*Pi*50 >> >> ts = 1/2.48 Hz = 0.0004 >> >> >> 0.0004 >> -(--------) >> 0.00318 >> K = 1 - e = 1 - 0.88 = 0.12 >>------------------------------------------------------------------------------> >Yes. (I would have written the last line either as e^(-.0004/.00318) or >exp(-.0004/.00318).) > >Jerry >-- >Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� >
sync filter: Can you help me to set 3 parameter?
Started by ●June 29, 2010
Reply by ●July 14, 20102010-07-14
Reply by ●July 14, 20102010-07-14
Hi Jerry Every time I take new sample I calculate the actual value of Y[i] and save it in a Y[i] array. Since I have few memory, which is the minumum number of Y[i] that I must save? Thanks P.S. Remember that Ft = 50 Hz Sample Rate = 2.48KHz>On 7/9/2010 5:42 AM, gpezzella wrote: >> Ok I will use this notation from now >> >> I previous post (7/1/2010 3:21 AM) you wrote me the follow equation: >> <a> "y[1] = k*x[i] + (1-k)*y[i-1] that behaves like a single RC". >> >> In the day 7/8/2010 I discovery another thread that use: >> <b> "Y[i] = K * X[i] + [1-K] * Y[i-1]" >> which is coincident to yours: >> <c> "Y[i] = [ X[i] - Y[i-1] ] * K + Y[i-1]" >> >> Today instead you write that: >> <d> "Y[i] = k*Y[i-1] + (k-1)*X[i]" is the correct equation >> >> Question 1: Which is the good one between a,b,c,d? > >They are all good. Where I initially have the coefficients as k and 1-k, >your other gave them as 1-k and k. Because k is an arbitrary constant, >the two notations are equivalent. After your response, I switched to >your notation. > >> Question 2: After choose the correct equation, is the follow methodcorrect>> for calculate K coefficient? >>-------------------------------------------------------------------------------->> ts >> -(--) Where: ts = sample period (seconds) >> T T = time constant (seconds) >> (1) K = 1 - e K = change in o/p after 1 ts >> >> >> The value for K is then used as the coefficient in the RC LPF code. >> >> If the above equation is correct I should use for my case: >> 1)Ft = 50 Hz >> 2)Sample Rate = 2.48KHz >> >> >> 1 >> T = ------- = 0.00318 >> 2*Pi*50 >> >> ts = 1/2.48 Hz = 0.0004 >> >> >> 0.0004 >> -(--------) >> 0.00318 >> K = 1 - e = 1 - 0.88 = 0.12 >>------------------------------------------------------------------------------> >Yes. (I would have written the last line either as e^(-.0004/.00318) or >exp(-.0004/.00318).) > >Jerry >-- >Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� >
Reply by ●July 14, 20102010-07-14
On 7/14/2010 7:14 AM, gpezzella wrote:> Hi Jerry > > Every time I take new sample I calculate the actual value of Y[i] and save > it in a Y[i] array.No. A variable, If you have one to dedicate, a register.> Since I have few memory, which is the minumum number of Y[i] that I must > save?You need only the last Y you calculated. The new one you calculate replaces it. Remember: this is a one-pole filter. You may need something with sharper cut-off. The simplest is a cascade of two or more of these, but there are computationally more efficient ones. http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html is an on-line application to design them. Try a two- or three-pole filter with a 3 dB cutoff point at 60 Hz. Jerry -- Engineering is the art of making what you want from things you can get.
Reply by ●July 15, 20102010-07-15
Dear Jerry,
GREAT LINK!! Thanks
If for example I choose:
-----------------------------------
filtertype = Chebyshev
passtype = Lowpass
ripple = -1
order = 5
samplerate = 2480
corner1 = 50
corner2 =
adzero =
logmin =
Recurrence relation:
y[n] = ( 1 * x[n- 5])
+ ( 5 * x[n- 4])
+ ( 10 * x[n- 3])
+ ( 10 * x[n- 2])
+ ( 5 * x[n- 1])
+ ( 1 * x[n- 0])
+ ( 0.8881071970 * y[n- 5])
+ ( -4.5278119979 * y[n- 4])
+ ( 9.2530651832 * y[n- 3])
+ ( -9.4749879058 * y[n- 2])
+ ( 4.8616237413 * y[n- 1])
----------------------------------
1) Always I must save Y[n] into a variable?
2) If yes, for check if there are been frequency under 50Hz I must only
compare Y[n] with a threshold, correct?
Thanks
>On 7/14/2010 7:14 AM, gpezzella wrote:
>> Hi Jerry
>>
>> Every time I take new sample I calculate the actual value of Y[i] and
save
>> it in a Y[i] array.
>
>No. A variable, If you have one to dedicate, a register.
>
>> Since I have few memory, which is the minumum number of Y[i] that I
must
>> save?
>
>You need only the last Y you calculated. The new one you calculate
>replaces it. Remember: this is a one-pole filter. You may need something
>with sharper cut-off. The simplest is a cascade of two or more of these,
>but there are computationally more efficient ones.
>http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html is an on-line
>application to design them. Try a two- or three-pole filter with a 3 dB
>cutoff point at 60 Hz.
>
>Jerry
>--
>Engineering is the art of making what you want from things you can get.
>
Reply by ●July 15, 20102010-07-15
On 7/15/2010 11:48 AM, gpezzella wrote:> Dear Jerry, > > GREAT LINK!! Thanks > > If for example I choose: > ----------------------------------- > filtertype = Chebyshev > passtype = Lowpass > ripple = -1 > order = 5 > samplerate = 2480 > corner1 = 50 > corner2 = > adzero = > logmin = > > Recurrence relation: > y[n] = ( 1 * x[n- 5]) > + ( 5 * x[n- 4]) > + ( 10 * x[n- 3]) > + ( 10 * x[n- 2]) > + ( 5 * x[n- 1]) > + ( 1 * x[n- 0]) > > + ( 0.8881071970 * y[n- 5]) > + ( -4.5278119979 * y[n- 4]) > + ( 9.2530651832 * y[n- 3]) > + ( -9.4749879058 * y[n- 2]) > + ( 4.8616237413 * y[n- 1]) > ----------------------------------Why do you need so sharp a cutoff? There will be attenuation at the corner frequency, so you should set it higher than what you want to pass unattenuated.> 1) Always I must save Y[n] into a variable?Your recursion relation needs 5 past x[n] and 5 past y[n]. You need to save them all, then update them for the next iteration.> 2) If yes, for check if there are been frequency under 50Hz I must only > compare Y[n] with a threshold, correct?That should work. Jerry -- Engineering is the art of making what you want from things you can get.
Reply by ●July 28, 20102010-07-28
Dear Jerry after been very busy with other stuff I finally have had time to write an application in VB6 that implement the 50 Hz filter create by your GREAT LINK. If possible I would send you my program for see if filter work good and more important: 1) How interpretate the output signal? With my program I do this step: 1) create wave sin 40Hz 2volt signal 2) add to previous one wave sin 200Hz 2volt signal 3) apply the filter but I obtain signal that is good wave sin of 40 Hz but with amplitude that go to [80volt] to [-1.8volt] How is possible??? My email is gpezzella@yahoo.com Please send me your email so I can send you my program. Giuseppe>On 7/15/2010 11:48 AM, gpezzella wrote: >> Dear Jerry, >> >> GREAT LINK!! Thanks >> >> If for example I choose: >> ----------------------------------- >> filtertype = Chebyshev >> passtype = Lowpass >> ripple = -1 >> order = 5 >> samplerate = 2480 >> corner1 = 50 >> corner2 = >> adzero = >> logmin = >> >> Recurrence relation: >> y[n] = ( 1 * x[n- 5]) >> + ( 5 * x[n- 4]) >> + ( 10 * x[n- 3]) >> + ( 10 * x[n- 2]) >> + ( 5 * x[n- 1]) >> + ( 1 * x[n- 0]) >> >> + ( 0.8881071970 * y[n- 5]) >> + ( -4.5278119979 * y[n- 4]) >> + ( 9.2530651832 * y[n- 3]) >> + ( -9.4749879058 * y[n- 2]) >> + ( 4.8616237413 * y[n- 1]) >> ---------------------------------- > >Why do you need so sharp a cutoff? > >There will be attenuation at the corner frequency, so you should set it >higher than what you want to pass unattenuated. > >> 1) Always I must save Y[n] into a variable? > >Your recursion relation needs 5 past x[n] and 5 past y[n]. You need to >save them all, then update them for the next iteration. > >> 2) If yes, for check if there are been frequency under 50Hz I must only >> compare Y[n] with a threshold, correct? > >That should work. > >Jerry >-- >Engineering is the art of making what you want from things you can get. >
Reply by ●July 28, 20102010-07-28
On 7/28/2010 4:49 PM, gpezzella wrote:> Dear Jerry > > after been very busy with other stuff I finally have had time to write an > application in VB6 that implement the 50 Hz filter create by your GREAT > LINK. > > If possible I would send you my program for see if filter work good and > more important: > > 1) How interpretate the output signal? > > With my program I do this step: > > 1) create wave sin 40Hz 2volt signal > 2) add to previous one wave sin 200Hz 2volt signal > 3) apply the filter > > but I obtain signal that is good wave sin of 40 Hz but with amplitude that > go to [80volt] to [-1.8volt]I don't understand your notation. What quantity is 80V? What quantity is -1.8V? (The negative sign probably represents a reversal of phase.> How is possible???Every filter has a gain. The gain of a low-pass filter is (exactly for Butterworth, within the ripple magnitude for Chebychev) the output after a long string of ones has been applied.> My email is gpezzella@yahoo.com > Please send me your email so I can send you my program.My email address in this post is correct. What language is your code? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������






