Testing a chebyshev filter

Started by Triff February 10, 2005
I'm not quite sure what I'm expecting as an output!
I seem to be getting a square wave from a sine wave with an continually 
decreasing frequency!
Is this right?
Cheers
Triff 


Triff wrote:

> I'm not quite sure what I'm expecting as an output! > I seem to be getting a square wave from a sine wave with an continually > decreasing frequency! > Is this right? > Cheers > Triff > >
More information please! I assume you've just coded up a shiny new Chebyschev filter, fed it a sine wave, and you're getting a square wave out? * What's the platform? * Matlab? * A DSP chip? * Simulink with a toolbox? * What's the amplitude of the input? * What's the amplitude of the output? * What's the frequency of the input? * What's the intended cutoff frequency(s) of the filter? * Is it high-pass, low-pass, band-pass, band-stop? * Is it IIR? FIR? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Sorry, DSP is all very new to me, and so my understanding is basic.
Programming in java.
Creating sine waves in a byte array with a frequency range from about 20hz 
to 20khz (ish). It's IIR and low-pass
Basically I've got 3 variables in the filter, frequency cut-off, percentage 
ripple and number of poles.
I know that the Chebyshev procedure outputs the correct numbers which I put 
them into the recursive filter procedure.
I can draw the input and the output but the output looks very wrong.
Whatever the variables I enter I just get different repetitions of square 
waves.

"Tim Wescott" <tim@wescottnospamdesign.com> wrote in message 
news:110ld8hnsj2dp7e@corp.supernews.com...
> Triff wrote: > >> I'm not quite sure what I'm expecting as an output! >> I seem to be getting a square wave from a sine wave with an continually >> decreasing frequency! >> Is this right? >> Cheers >> Triff > More information please! > > I assume you've just coded up a shiny new Chebyschev filter, fed it a sine > wave, and you're getting a square wave out? > > * What's the platform? > * Matlab? > * A DSP chip? > * Simulink with a toolbox? > * What's the amplitude of the input? > * What's the amplitude of the output? > * What's the frequency of the input? > * What's the intended cutoff frequency(s) of the filter? > * Is it high-pass, low-pass, band-pass, band-stop? > * Is it IIR? FIR? > > -- > > Tim Wescott > Wescott Design Services > http://www.wescottdesign.com
Sounds like you have a bug.  If you put in a sine wave, you should get out a
sine wave.  To simply, try putting in an impulse--a single sample of one (or
whatever your typical maximum input value is) followed by all zeros and then see
what you get out.  Your output should jump up and then decay toward zero,
probably oscillating around zero a few times, depending on the filter
parameters.  You can also try putting in "DC" (a string of identical input
values) and make sure you get the same DC value out (assuming your filter has
unity gain at DC).

"Triff" <neverread@yahoo.com> wrote in message
news:36vsflF56ukunU1@individual.net...
> Sorry, DSP is all very new to me, and so my understanding is basic. > Programming in java. > Creating sine waves in a byte array with a frequency range from about 20hz > to 20khz (ish). It's IIR and low-pass > Basically I've got 3 variables in the filter, frequency cut-off, percentage > ripple and number of poles. > I know that the Chebyshev procedure outputs the correct numbers which I put > them into the recursive filter procedure. > I can draw the input and the output but the output looks very wrong. > Whatever the variables I enter I just get different repetitions of square > waves. > > "Tim Wescott" <tim@wescottnospamdesign.com> wrote in message > news:110ld8hnsj2dp7e@corp.supernews.com... > > Triff wrote: > > > >> I'm not quite sure what I'm expecting as an output! > >> I seem to be getting a square wave from a sine wave with an continually > >> decreasing frequency! > >> Is this right? > >> Cheers > >> Triff > > More information please! > > > > I assume you've just coded up a shiny new Chebyschev filter, fed it a sine > > wave, and you're getting a square wave out? > > > > * What's the platform? > > * Matlab? > > * A DSP chip? > > * Simulink with a toolbox? > > * What's the amplitude of the input? > > * What's the amplitude of the output? > > * What's the frequency of the input? > > * What's the intended cutoff frequency(s) of the filter? > > * Is it high-pass, low-pass, band-pass, band-stop? > > * Is it IIR? FIR? > > > > -- > > > > Tim Wescott > > Wescott Design Services > > http://www.wescottdesign.com > >
Cool cheers, think I'm getting there now, this might sound like a really dum 
question but what use to chebushev filters have!?

"Jon Harris" <goldentully@hotmail.com> wrote in message 
news:36vsqdF58oioiU1@individual.net...
> Sounds like you have a bug. If you put in a sine wave, you should get out > a > sine wave. To simply, try putting in an impulse--a single sample of one > (or > whatever your typical maximum input value is) followed by all zeros and > then see > what you get out. Your output should jump up and then decay toward zero, > probably oscillating around zero a few times, depending on the filter > parameters. You can also try putting in "DC" (a string of identical input > values) and make sure you get the same DC value out (assuming your filter > has > unity gain at DC). > > "Triff" <neverread@yahoo.com> wrote in message > news:36vsflF56ukunU1@individual.net... >> Sorry, DSP is all very new to me, and so my understanding is basic. >> Programming in java. >> Creating sine waves in a byte array with a frequency range from about >> 20hz >> to 20khz (ish). It's IIR and low-pass >> Basically I've got 3 variables in the filter, frequency cut-off, >> percentage >> ripple and number of poles. >> I know that the Chebyshev procedure outputs the correct numbers which I >> put >> them into the recursive filter procedure. >> I can draw the input and the output but the output looks very wrong. >> Whatever the variables I enter I just get different repetitions of square >> waves. >> >> "Tim Wescott" <tim@wescottnospamdesign.com> wrote in message >> news:110ld8hnsj2dp7e@corp.supernews.com... >> > Triff wrote: >> > >> >> I'm not quite sure what I'm expecting as an output! >> >> I seem to be getting a square wave from a sine wave with an >> >> continually >> >> decreasing frequency! >> >> Is this right? >> >> Cheers >> >> Triff >> > More information please! >> > >> > I assume you've just coded up a shiny new Chebyschev filter, fed it a >> > sine >> > wave, and you're getting a square wave out? >> > >> > * What's the platform? >> > * Matlab? >> > * A DSP chip? >> > * Simulink with a toolbox? >> > * What's the amplitude of the input? >> > * What's the amplitude of the output? >> > * What's the frequency of the input? >> > * What's the intended cutoff frequency(s) of the filter? >> > * Is it high-pass, low-pass, band-pass, band-stop? >> > * Is it IIR? FIR? >> > >> > -- >> > >> > Tim Wescott >> > Wescott Design Services >> > http://www.wescottdesign.com >> >> > >
"Triff" <neverread@yahoo.com> wrote in message
news:371juiF3trmsrU1@individual.net...
> Cool cheers, think I'm getting there now, this might sound like a really
dum
> question but what use to chebushev filters have!?
Chebychev filters are just one type of filter. Filters in general, as the name implies, are used to filter out unwanted frequencies. A low pass filter passes all frequencies lower than a certain cut-off (Fc). A band-pass filter passes all frequencies in a certain 'band' (F_low and F_high). You can extend this to what high-pass filters are. One can build these types of filters using various architectures and various 'equations' that govern their shape in the frequency domain. Some of these equations have names (Chebychev, Butterworth, etc) since some dudes were the first to raise their hand and say "I've got a new one fellas". Filters are used in all kinds of applications including sound/audio processing, video processing, image processing, digital communications, etc Hope that helps... Cheers Bhaskar
> > "Jon Harris" <goldentully@hotmail.com> wrote in message > news:36vsqdF58oioiU1@individual.net... > > Sounds like you have a bug. If you put in a sine wave, you should get
out
> > a > > sine wave. To simply, try putting in an impulse--a single sample of one > > (or > > whatever your typical maximum input value is) followed by all zeros and > > then see > > what you get out. Your output should jump up and then decay toward
zero,
> > probably oscillating around zero a few times, depending on the filter > > parameters. You can also try putting in "DC" (a string of identical
input
> > values) and make sure you get the same DC value out (assuming your
filter
> > has > > unity gain at DC). > > > > "Triff" <neverread@yahoo.com> wrote in message > > news:36vsflF56ukunU1@individual.net... > >> Sorry, DSP is all very new to me, and so my understanding is basic. > >> Programming in java. > >> Creating sine waves in a byte array with a frequency range from about
> >> 20hz > >> to 20khz (ish). It's IIR and low-pass > >> Basically I've got 3 variables in the filter, frequency cut-off, > >> percentage > >> ripple and number of poles. > >> I know that the Chebyshev procedure outputs the correct numbers which I > >> put > >> them into the recursive filter procedure. > >> I can draw the input and the output but the output looks very wrong. > >> Whatever the variables I enter I just get different repetitions of
square
> >> waves. > >> > >> "Tim Wescott" <tim@wescottnospamdesign.com> wrote in message > >> news:110ld8hnsj2dp7e@corp.supernews.com... > >> > Triff wrote: > >> > > >> >> I'm not quite sure what I'm expecting as an output! > >> >> I seem to be getting a square wave from a sine wave with an > >> >> continually > >> >> decreasing frequency! > >> >> Is this right? > >> >> Cheers > >> >> Triff > >> > More information please! > >> > > >> > I assume you've just coded up a shiny new Chebyschev filter, fed it a > >> > sine > >> > wave, and you're getting a square wave out? > >> > > >> > * What's the platform? > >> > * Matlab? > >> > * A DSP chip? > >> > * Simulink with a toolbox? > >> > * What's the amplitude of the input? > >> > * What's the amplitude of the output? > >> > * What's the frequency of the input? > >> > * What's the intended cutoff frequency(s) of the filter? > >> > * Is it high-pass, low-pass, band-pass, band-stop? > >> > * Is it IIR? FIR? > >> > > >> > -- > >> > > >> > Tim Wescott > >> > Wescott Design Services > >> > http://www.wescottdesign.com > >> > >> > > > > > >
Bhaskar Thiagarajan wrote:

> "Triff" <neverread@yahoo.com> wrote in message
...
>>question but what use to chebushev filters have!? > > > Chebychev filters are just one type of filter. > Filters in general, as the name implies, are used to filter out unwanted > frequencies. A low pass filter passes all frequencies lower than a certain > cut-off (Fc). A band-pass filter passes all frequencies in a certain 'band' > (F_low and F_high). You can extend this to what high-pass filters are. > One can build these types of filters using various architectures and various > 'equations' that govern their shape in the frequency domain. Some of these > equations have names (Chebychev, Butterworth, etc) since some dudes were the > first to raise their hand and say "I've got a new one fellas". > Filters are used in all kinds of applications including sound/audio > processing, video processing, image processing, digital communications, etc
More specifically, Chebyshev filters allow ripple in the passband in order to achieve sharper and steeper stopbands. Chebychev himself never heard of signal processing, but he invented a method of forcing approximations to have equal-magnitude ripples. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
"Jerry Avins" <jya@ieee.org> wrote in message 
news:dK2dnaxul_zRKpbfRVn-1Q@rcn.net...
> Bhaskar Thiagarajan wrote: > >> "Triff" <neverread@yahoo.com> wrote in message > > ... > >>>question but what use to chebushev filters have!? >> >> >> Chebychev filters are just one type of filter. >> Filters in general, as the name implies, are used to filter out unwanted >> frequencies. A low pass filter passes all frequencies lower than a >> certain >> cut-off (Fc). A band-pass filter passes all frequencies in a certain >> 'band' >> (F_low and F_high). You can extend this to what high-pass filters are. >> One can build these types of filters using various architectures and >> various >> 'equations' that govern their shape in the frequency domain. Some of >> these >> equations have names (Chebychev, Butterworth, etc) since some dudes were >> the >> first to raise their hand and say "I've got a new one fellas". >> Filters are used in all kinds of applications including sound/audio >> processing, video processing, image processing, digital communications, >> etc > > More specifically, Chebyshev filters allow ripple in the passband in > order to achieve sharper and steeper stopbands. Chebychev himself never > heard of signal processing, but he invented a method of forcing > approximations to have equal-magnitude ripples.
Filters are often designed first (in general) by stating an objective criterion or desired response D(x). This can be a general specification such as lowpass, highpass, etc. and then, later, the user of the method can select some filter parameters - like the cutoff frequency. Then the formulator of the method choses some algebraic formulation using some set of functions like: A(x)=a +bx +cx^2.... or A(x)=a1 +b1cos(x) +b2sin(x) +c1*cos(x) +c2sin(x) +d1*cos(2x) +d2*sin(2x) .... to represent the design that *approximates* D(x). The design task is to find the coefficients a,b,c..... so that some function of the error [D(x)-A(x)] is minimized. So, the formulator figures this out and the end designer just needs to use the method. A common function of the error is sum over x of [D(x)-A(x)]^N where N is generally an even integer so that the measure is always positive. You can see that as N gets bigger, the highest peak of D-A is emphasized more. With most approximation situations the Chebyshev approach means that you are minimizing the maximum error - as measured against the objective criterion or desired filter response that is stated up front. No other filter of the same order can have a smaller peak error. This is known as the minimax or L-infinity norm (N above is very high)- where the error is weighted so heavily (taken to the power of "infinity" in concept) that all that can happen is the highest peak of the error is minimized. There are other measures like L2 which minimizes the sum of the square of the errors, L1 that minimizes the sum of the errors, etc. There may be a very small difference between L10 and L-infinity..... I believe the original Chebyshev polynomials generated maximally flat passband and minimax / equiripple stopband. Now there are programs that design filters that are minimax in both the passband and stopband and these are sometimes called Chebyshev filters and most often, equiripple. The method to get them works to MINimize the MAXimum error - thus, minimax. So, that's what "Chebyshev", equiripple or minimax means. It has only little to do with the goodness of the filter for any particular application and some other base method might just as readily be used. Fred