DSPRelated.com
Forums

Who knows this type of filter

Started by Unknown December 18, 2018
Hi everyone,

I've got only formula for filter and seeking for how to calculate coefficients:

Do this code for every incoming sample in

t1 = dyn - in*c1         
dyn =  in +  t1*c1        
t2 =   t1*  c2        
out = t2 + in*  c3

dyn should be 0 at first sample i think
c1,c2,c3 are coefficients
t1,t2 and dyn are temporaries

This suppose to be shelving filter and parameters are gain and cutoff

From expansion to in-3 sample I've got:

t1 = in + (in-1 + (in-2 + ((in-3 + (dyn-4 - in-3*c1)*c1) - in-2*c1)*c1 -in-1*c1)*c1)

so this is some kind of exponential filter  which I never saw because it includes old samples with increasing power of c1 coefficient 

I also assume that filter type is FIR because it doesn't account for output samples

Appreciate any help !!!

reagards,
Robert
On 18/12/2018 7:31, robert.szymiec@gmail.com wrote:

> dyn should be 0 at first sample i think > c1,c2,c3 are coefficients > t1,t2 and dyn are temporaries
t1,t2 are temporary values for calculations. It's a 1st order filter The state variable is dyn dyn = in + t1*c1 = in + (dyn-in*c1)*c1 --> dyn = dyn*c1 + in*(1-c1*c1) out = t2 + in*c3 = t1*c2 + in*c3 = (dyn-in*c1)*c2 + in*c3 --> out = dyn*c2 + in*(c3-c1*c2)
W dniu wtorek, 18 grudnia 2018 17:20:36 UTC+1 u=C5=BCytkownik Eduardo napis=
a=C5=82:
> On 18/12/2018 7:31, wrote: >=20 > > dyn should be 0 at first sample i think > > c1,c2,c3 are coefficients > > t1,t2 and dyn are temporaries >=20 > t1,t2 are temporary values for calculations. >=20 > It's a 1st order filter >=20 > The state variable is dyn > dyn =3D in + t1*c1 =3D in + (dyn-in*c1)*c1 > --> dyn =3D dyn*c1 + in*(1-c1*c1) >=20 >=20 > out =3D t2 + in*c3 =3D t1*c2 + in*c3 =3D (dyn-in*c1)*c2 + in*c3 > --> out =3D dyn*c2 + in*(c3-c1*c2)
Thanks for reply Do you have some references about this type of filter (how this type of fil= ter is described in literature ? ). I need to calculate coefficients c1,c2,= c3 for high and low shelving filter from gain and cutoff frequency reagards, Robert
On 19/12/2018 6:34, robert.szymiec@gmail.com wrote:
> W dniu wtorek, 18 grudnia 2018 17:20:36 UTC+1 użytkownik Eduardo napisał: >> On 18/12/2018 7:31, wrote: >> >>> dyn should be 0 at first sample i think >>> c1,c2,c3 are coefficients >>> t1,t2 and dyn are temporaries >> >> t1,t2 are temporary values for calculations. >> >> It's a 1st order filter >> >> The state variable is dyn >> dyn = in + t1*c1 = in + (dyn-in*c1)*c1 >> --> dyn = dyn*c1 + in*(1-c1*c1) >> >> >> out = t2 + in*c3 = t1*c2 + in*c3 = (dyn-in*c1)*c2 + in*c3 >> --> out = dyn*c2 + in*(c3-c1*c2) > > Thanks for reply > > Do you have some references about this type of filter (how this type of filter is described in literature ? ). I need to calculate coefficients c1,c2, c3 for high and low shelving filter from gain and cutoff frequency > > reagards, > Robert >
Writing terms of Z transform: dyn = dyn*c1 + in*(1-c1*c1) ==> z DYN = DYN*c1 + IN*(1-c1*c1) ==> DYN = IN*(1-c1^2)/(z-c1) out = dyn*c2 + in*(c3-c1*c2) ==> OUT = DYN*c2 + IN*(c3-c1*c2) = IN*( c2*(1-c1^2)/(z-c1) + (c3-c1*c2)) Applying the bilinear transformation z = (2+s T)/(2-s T) ; T: sampling time ...algebra...and finally OUT(s) = (a + b*c*s)/(1+c*s) * IN(s) a= c3+c2 b= c3-c2 c= (1+c1)/(1-c1) * T/2 (1-c1)/(1+c1) * 2/T = cutoff frequency (radians) If c2 = c3 ==> Lowpass filter c2 = -c3 ==> Highpass filter Warning: I not did any check :) Regards.