Reply by Jerry Avins September 24, 20042004-09-24
Piergiorgio Sartor wrote:

> Jerry Avins wrote: > >> That seems very strange to me; I would have thought it is a sinc. Can >> you explain? > > > You can see it from a different point of view. > > Two (symmetric) 1s in the frequency domain correspond to > a cos() function in the time domain. > > But the FT is going back and forward in the same way, > so two (symmetric) 1s in the time domain must be a cos() > in the frequency domain... > > Similar thinking can be done for [1,-1] and sin(), only > I guess some imaginary part has to be considered. > > Of course the frequency calculation is left as exercise > for the student... :-) > > bye,
Another neat answer. "I love it when things come together!" Jerry -- ... they proceeded on the sound principle that the magnitude of a lie always contains a certain factor of credibility, ... and that therefor ... they more easily fall victim to a big lie than to a little one ... A. H. �����������������������������������������������������������������������
Reply by Jerry Avins September 24, 20042004-09-24
Rick Lyons wrote:

   ...

> Neat Jim. Really neat. > Thanks. > > [-Rick-]
And thanks again from me too. You really tied things together for me, starting with your first answer to me in this thread. It got me thinking and off autopilot. For all the good it will do! Hah! Jerry -- ... they proceeded on the sound principle that the magnitude of a lie always contains a certain factor of credibility, ... and that therefor ... they more easily fall victim to a big lie than to a little one ... A. H. �����������������������������������������������������������������������
Reply by Rick Lyons September 24, 20042004-09-24
On Fri, 24 Sep 2004 09:11:24 -0500, jim <"N0sp"@m.sjedging@mwt.net>
wrote:

> >Hi Rick > My newsreader seems to have missed some posts. This is the first one I >see since my last post. (see more below) > >Rick Lyons wrote: >> >> On Thu, 23 Sep 2004 10:23:43 -0400, Jerry Avins <jya@ieee.org> wrote: >> >> >Rick Lyons wrote: > >> >> The complex freq response of >> >> 1 + cos(w) -jsin(w) >> >> can be written >> >> 1 + exp(-jw) >> >> = exp(-jw/2)[exp(jw/2) + exp(-jw/2)]. >> >> Those terms inside the brackets are equal to >> >> 2cos(w/2). >> >> So the magnitude of the complex freq response is >> >> |exp(-jw/2)[2cos(w/2)]| = 2cos(w/2). >> >> Sheece, how simple!
Hi Jim,
>> (The above is surely what Jim was saying when he >> wrote: "e^(i(x+a)) + e^(i(x-a)) = 2*cos(a)*e^ix".)
Yep, me too.
>Yes, glad you waded through the math (and didn't make me do it). > > Remember the OP's problem was with image processing and pixels, so >there's no need to be concerned with causality. Therefore one is free to >express the frequency response with reference to the center of the >filter rather than the end as you do (that's where your exp(-jw/2) comes >from). So it could be said like this: averaging 2 pixels produces the >cosine magnitude response at the point halfway in between.
Ah ha. yes.
>> *** NOW *** >> >> Someone might read our thread and say: "Why the heck >> are Jerry and Rick screwing around with this >> silly simple two-coefficient filter's magnitude >> response?" >> >> The reason is: the above sinusoidal shaped magnitude >> response *also* applies to a transversal FIR filter >> whose coefficients are >> >> h1(k) = 1,0,0,0,0,0,0,1. >> >> This h1(k) is an example of a comb filter used in >> some "frequency sampling filters". (Section 7.1 of >> my book). >> >> In addition, that sinusoidal shaped magnitude response >> *also* applies to a transversal FIR filter whose >> coefficients are >> >> h1(k) = 1,0,0,0,0,0,0,-1 > >Right, but in that case the response will be a sine function.
Yep. You're right. That's why I used the phrase "sinusoidal shpaed".
>> which is an example of the comb portion of a cascaded >> integrator-comb (CIC) filter used in many digital >> communications systems. >> >> Neat huh? > >Yes, and if you constrain your filters to purely symmetric or purely >anti-symmetric FIR (as people inevitably do in image processing), then >any such filter can be expressedas a simple sum of sines or cosines. >For example, an even length box car filter can be considered to be the >sum of the filters: > > [1,1] + [1,0,0,1] + [1,0,0,0,0,1] ..... > >And therefore the magnitude response is just the sum of the respective >cosine functions. > >-jim
Ah ha. Yes, yes. I knew that symmetrical transversal FIR filters have a freq magnitude response that are the sums of cosine functions, but I've never looked at your example (interpretation) before. (That a boxcar can be viewed as a group of parallel comb filters. Composite impulse response is the sum of individual impulse responses.) Neat Jim. Really neat. Thanks. [-Rick-]
Reply by Piergiorgio Sartor September 24, 20042004-09-24
Jerry Avins wrote:

> That seems very strange to me; I would have thought it is a sinc. Can > you explain?
You can see it from a different point of view. Two (symmetric) 1s in the frequency domain correspond to a cos() function in the time domain. But the FT is going back and forward in the same way, so two (symmetric) 1s in the time domain must be a cos() in the frequency domain... Similar thinking can be done for [1,-1] and sin(), only I guess some imaginary part has to be considered. Of course the frequency calculation is left as exercise for the student... :-) bye, -- Piergiorgio Sartor
Reply by jim September 24, 20042004-09-24
Hi Rick
	My newsreader seems to have missed some posts. This is the first one I
see since my last post. (see more below)

Rick Lyons wrote:
> > On Thu, 23 Sep 2004 10:23:43 -0400, Jerry Avins <jya@ieee.org> wrote: > > >Rick Lyons wrote:
> > The complex freq response of > > 1 + cos(w) -jsin(w) > > can be written > > 1 + exp(-jw) > > = exp(-jw/2)[exp(jw/2) + exp(-jw/2)]. > > Those terms inside the brackets are equal to > > 2cos(w/2). > > So the magnitude of the complex freq response is > > |exp(-jw/2)[2cos(w/2)]| = 2cos(w/2). > > Sheece, how simple! > > (The above is surely what Jim was saying when he > wrote: "e^(i(x+a)) + e^(i(x-a)) = 2*cos(a)*e^ix".)
Yes, glad you waded through the math (and didn't make me do it). Remember the OP's problem was with image processing and pixels, so there's no need to be concerned with causality. Therefore one is free to express the frequency response with reference to the center of the filter rather than the end as you do (that's where your exp(-jw/2) comes from). So it could be said like this: averaging 2 pixels produces the cosine magnitude response at the point halfway in between.
> > *** NOW *** > > Someone might read our thread and say: "Why the heck > are Jerry and Rick screwing around with this > silly simple two-coefficient filter's magnitude > response?" > > The reason is: the above sinusoidal shaped magnitude > response *also* applies to a transversal FIR filter > whose coefficients are > > h1(k) = 1,0,0,0,0,0,0,1. > > This h1(k) is an example of a comb filter used in > some "frequency sampling filters". (Section 7.1 of > my book). > > In addition, that sinusoidal shaped magnitude response > *also* applies to a transversal FIR filter whose > coefficients are > > h1(k) = 1,0,0,0,0,0,0,-1
Right, but in that case the response will be a sine function.
> > which is an example of the comb portion of a cascaded > integrator-comb (CIC) filter used in many digital > communications systems. > > Neat huh?
Yes, and if you constrain your filters to purely symmetric or purely anti-symmetric FIR (as people inevitably do in image processing), then any such filter can be expressed as a simple sum of sines or cosines. For example, an even length box car filter can be considered to be the sum of the filters: [1,1] + [1,0,0,1] + [1,0,0,0,0,1] ..... And therefore the magnitude response is just the sum of the respective cosine functions. -jim -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Reply by Rick Lyons September 24, 20042004-09-24
On Thu, 23 Sep 2004 10:23:43 -0400, Jerry Avins <jya@ieee.org> wrote:

>Rick Lyons wrote: > > ... > >> What I'm unable to do is prove to myself >> (algebraically) that the magnitude of >> >> 1 + cos(w) -jsin(w) >> >> equals 2cos(w/2).
Hi Jerry,
>Let M = magnitude >M&#4294967295; = [1 + cos(w) - jsin(w)]&#4294967295; &#4294967295; [1 + cos(w) + jsin(w)]&#4294967295;
Humm, I don't know about the above, but I like the following.
>= [1 + cos(w)]&#4294967295; + sin&#4294967295;(w) >= 1 + 2cos(w) + cos&#4294967295;(w) + sin&#4294967295;(w) >= 2 + 2cos(w) = 2[1+ cos(w)]
Yes, yes. Next we say: M&#4294967295; = 4[1+cos(w)]/2. Then we use the "half-angle" trig identity of: sqrt([1+cos(w)]/2) = cos(w/2), to state sqrt(4[1+cos(w)]/2) = sqrt(4)cos(w/2) = 2cos(w/2). Good Jerry! --- Aarrggh! I see another way: The complex freq response of 1 + cos(w) -jsin(w) can be written 1 + exp(-jw) = exp(-jw/2)[exp(jw/2) + exp(-jw/2)]. Those terms inside the brackets are equal to 2cos(w/2). So the magnitude of the complex freq response is |exp(-jw/2)[2cos(w/2)]| = 2cos(w/2). Sheece, how simple! (The above is surely what Jim was saying when he wrote: "e^(i(x+a)) + e^(i(x-a)) = 2*cos(a)*e^ix".) *** NOW *** Someone might read our thread and say: "Why the heck are Jerry and Rick screwing around with this silly simple two-coefficient filter's magnitude response?" The reason is: the above sinusoidal shaped magnitude response *also* applies to a transversal FIR filter whose coefficients are h1(k) = 1,0,0,0,0,0,0,1. This h1(k) is an example of a comb filter used in some "frequency sampling filters". (Section 7.1 of my book). In addition, that sinusoidal shaped magnitude response *also* applies to a transversal FIR filter whose coefficients are h1(k) = 1,0,0,0,0,0,0,-1 which is an example of the comb portion of a cascaded integrator-comb (CIC) filter used in many digital communications systems. Neat huh? [-Rick-]
Reply by Jerry Avins September 23, 20042004-09-23
Rick Lyons wrote:

   ...

> What I'm unable to do is prove to myself > (algebraically) that the magnitude of > > 1 + cos(w) -jsin(w) > > equals 2cos(w/2).
Let M = magnitude M&#4294967295; = [1 + cos(w) - jsin(w)]&#4294967295; &#4294967295; [1 + cos(w) + jsin(w)]&#4294967295; = [1 + cos(w)]&#4294967295; + sin&#4294967295;(w) = 1 + 2cos(w) + cos&#4294967295;(w) + sin&#4294967295;(w) = 2 + 2cos(w) = 2[1+ cos(w)] Now we need the square root. Let's cheat, and square 2cos(w/2). Do you see it now? Jerry -- ... they proceeded on the sound principle that the magnitude of a lie always contains a certain factor of credibility, ... and that therefor ... they more easily fall victim to a big lie than to a little one ... A. H. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by Bernhard Holzmayer September 23, 20042004-09-23
Jerry Avins wrote:

> Bernhard Holzmayer wrote: > > ... > >> Can you imagine a better version of anti-aliasing filter when >> decimation ratio is variable as N(t):1 ? > > There was a time when I thought I understood your problem. It's > clear now that I don't. Why do you need to decimate? > > Jerry
My samples have been taken at a rate of 48kS/s (A), at an earlier stage. Then I resample the signal at a lower rate which is variable, in fact between 0...48kS/s, let's assume 32S/s...8kS/s for now (to avoid other issues), rate B. Although my variable rate B is special, the concept seems to be that of a decimation process. First approach: at every clock of rate B I pick the current sample out of rate A. Works well, but lots of aliasing... Second approach: at every clock of rate B I pick the average of the samples at rate A since the last take at rate B. That's the filter with h=1,1,... coeffs. Works better, since less aliasing effects. Guess: the filter cannot be optimal, because the averaging isn't done continuously, but in "chunks". The steps on the borders are suboptimal. Therefore my query for a better "decimation filter". Maybe, my current solution is already good enough, and cannot be improved much without big effort... Bernhard
Reply by Rick Lyons September 23, 20042004-09-23
On Wed, 22 Sep 2004 08:23:30 -0500, jim <"N0sp"@m.sjedging@mwt.net>
wrote:

> > >Jerry Avins wrote: >> >> jim wrote: >> >> ... >> >> > Hi Martin >> > The frequency response of your filter [1,1] is just cos function. >> >> ... >> >> That seems very strange to me; I would have thought it is a sinc. Can >> you explain? > >e^(i(x+a)) + e^(i(x-a)) = 2*cos(a)*e^ix > >The frequency response is a sinc (sin(x)/x) only in the limit if you >have an infinite number of ones in your filter. For a finite length >filter its what's often called an aliased or periodic sinc. A periodic >sinc can also be expressed as a summation of geometric progression of >cosines (you need only the above equation to derive that fact). In this >particular case the summation only has one term. > >-jim
Hi Jim, I never realized that the absolute value of the DFT of [1,1] was a cosine function. I think you're right, although I don't know from where your equation came. (If "x" represents frequency, what is "a"?). You made me realize that a system with an impulse response of [1,1] is a special kind of delay-comb filter and I happen to know that those filters have a freq magnitude response that's sinusoidal in shape with a peak value of 2. So I believe the magnitude of the freq response of a two-tap (unity-valued coefficients) is: |X(w)| = 2cos(w/2) where w is in the range 0 -to- 2pi, and represents frequency. The discrete time Fourier transform of the sequence [1,1] is: X(w) = 1 + cos(w) -jsin(w). What I'm unable to do is prove to myself (algebraically) that the magnitude of 1 + cos(w) -jsin(w) equals 2cos(w/2). By the way, as far as I've seen, the DFT of a finite number of ones is called a "Dirichlet kernel". See Ya, [-Rick-]
Reply by Jerry Avins September 22, 20042004-09-22
jim wrote:

   ...

> In this particular case the summation only has one term. > > -jim
Neat!. Thanks. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;