Reply by Fred Marshall September 24, 20042004-09-24
"I. R. Khan" <ir_khan@hotmail.com> wrote in message 
news:2ri622F1amb7hU1@uni-berlin.de...
> Thanks Fred and Jerry for your help. > > If the magnitude response of a filter is > H(w) = pi sin(w/2) - sin(w), where w is frequency, > then does this filter has linear phase, and how much is the delay? > > If you plot H(w), you will find that it is a differentiator, more accurate > at higher frequencies. > > If response is H(w) = sin(w/2), then I can understand that this filter has > coefficients {-1, 1}, and if it is H(w) = sin(w), then coefficients are > {-1, > 0, 1}. But I am unable to understand it in this form. Please comment on > whether this filter can be implemented in time or frequency domian or > both? > > These differentiators are presented in IEEE T. CAS 36(6) 890-893, 1989.
Ishtiaq,
> If the magnitude response of a filter is > H(w) = pi sin(w/2) - sin(w), where w is frequency, > then does this filter has linear phase, and how much is the delay?
Well, because you say this is the "magnitude response" there's no phase information. So, except in special cases, there may not be enough information to answer the question about phase and delay.
> If response is H(w) = sin(w/2), then I can understand that this filter has > coefficients {-1, 1}, and if it is H(w) = sin(w), then coefficients are > {-1, > 0, 1}. But I am unable to understand it in this form. Please comment on > whether this filter can be implemented in time or frequency domian or > both?
It seems to me that you've answered your own question. You have the frequency response and you have the filter coefficients - which are also the values of the unit sample response ("impulse response") in the time domain. Actually I believe your second assertions are incorrect. If H(w) = sin(w/2) then H(w) is odd and h(t) would be purely imaginary. Ditto for H(w) = sin(w). So, I believe you will find that you need to specify H(w) = -jsin(w) to get those real coefficients. I'm unclear as to what you don't understand. If there are two unit samples spaced 1 sample distance apart then you will get a sinousoid of the lowest possible frequency in the transform. If they are spaced two samples apart, you will get a sinusoid that is double that frequency, etc.... Maybe it's easier to visualize if you start in the time domain with .. 0 0 0 -1 1 0 0 0 .. unit sample spacing of 1 where time=0 occurs between the two unit samples. and .. 0 0 0 -1 0 1 0 0 0 .. unit sample spacing of 2 where time=0 occurs at the center zero. Note that the first example has samples spaced at T but they are separated from t=0 by KT+T/2 where K is an integer. Perhaps better said is that the first one, in order to beDoubling the sample rate will make that more apparent: .. 0 0 0 0 0 0 -1 0 1 0 0 0 0 0 0 .. unit sample spacing of 2 and .. 0 0 0 0 0 0 -1 0 0 0 1 0 0 0 0 0 0.. unit sample spacing of 4 For something like matlab or scilab you would actually write these to get purely imaginary transforms as: [1 0 0 0 0 0 0 -1] t= T 3T (N-1)T and [0 1 0 0 0 0 0 -1] t= T 3T (N-1)T so that they have antisymmetry around t=0 and t=N or. As you probably know, these can be viewed as periodic sequences that look like this: [1 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 -1......] t= T 3T NT [0 1 0 0 0 0 0 -1 0 1 0 0 0 0 0 -1 .....] t= T 2T 4T NT The symmtetry is more obvious around NT so you have to visualize the "wrap" from t=0 to t=NT in the length N sequences. Fred
Reply by I. R. Khan September 24, 20042004-09-24
Thanks Fred and Jerry for your help.

If the magnitude response of a filter is
H(w) = pi  sin(w/2) - sin(w), where w is frequency,
then does this filter has linear phase, and how much is the delay?

If you plot H(w), you will find that it is a differentiator, more accurate
at higher frequencies.

If response is H(w) = sin(w/2), then I can understand that this filter has
coefficients {-1, 1}, and if it is H(w) = sin(w), then coefficients are {-1,
0, 1}. But I am unable to understand it in this form. Please comment on
whether this filter can be implemented in time or frequency domian or both?

These differentiators are presented in IEEE T. CAS 36(6) 890-893, 1989.

Regards,
Ishtiaq.

Reply by Fred Marshall September 22, 20042004-09-22
"I. R. Khan" <ir_khan@hotmail.com> wrote in message 
news:2r9nclF177220U1@uni-berlin.de...
>I have read some papers about how to calculate filter coefficients. That is > fine. > > Then there are some other papers, which just give expressions for the > frequency response of the filter, and say this is the design. Could any > one > please tell me how are these designs useful? My understanding is that to > use > these filters, one has to take Fourier Transform of the signal, then > multiply it with frequency response of filter and then do Inverse > Transformation. Is this true, or there is some way to find filter > coefficients from the frequency response of the filter? > > A related question: Is the above method of filtering in frequency domain > less accurate as compared to direct implementation using filter > coefficients?
Ishtiaq, The method of using such filters goes like this: 1) Establish the filter response in the frequency domain (a complex function of frequency). The length of the array or frequency sequence needs to be the same as the signal sequences you will filter - because the multiplication is point-for-point of course. 2) Get a signal sample that has the same number of samples as the filter - or, if you wish, get a shorter sample and add enough zeros at the end to yield the same number of samples as the filter. 3) FFT the signal thus generated. 4) Multiply the signal's FFT by the frequency domain filter. 5) IFFT the result to get the time-domain filtered signal. Use overlap methods if subsequent sequences are to be processed and concatenated into a longer temporal sequence. Note: This method can be much more computationally efficient than time-domain convolution! Not an intuitively obvious thing is it? The longer the sequences the more this is the case. Now, if the filter is defined in the frequency domain in the first place, then it has to be a complex sequence. If it is not a complex sequence then it must be purely real. If it's pureley real then it must have an IFFT that is real and even in the time domain - a symmetrical FIR filter. So, to get the time domain version of the filter you take the IFFT of the frequency samples. It's that simple. More advanced topics might be: - is the filter "centered" in frequency so that the IFFT result is purely real? You may have to rotate the samples in frequency first depending on how you have them stored / defined. - is the filter specification really a (real) magnitude response of a filter that's really complex? In that case you have to figure out how to manipulate the frequency response before doing the IFFT. There are lots of discussions on this sort of thing and it's fair to say that you'd be more interested in phase. Otherwise, a real, even frequency magnitude response might well be IFFT'd to get a real, symmetrical FIR filter in the time domain. Fred
Reply by Jerry Avins September 22, 20042004-09-22
I. R. Khan wrote:

> Thanks Jerry. I shall wait for your reply in the morning. Here it is 13:30, > i.e. GMT + 9. > The filter I wrote is not IIR. All my questions were about FIR. To say it > simply, the magnitude response has two summations, one has sin(nw) and other > sin(n-1/2)w.
sin((n-1)x)? What is 'w' here? How would I assign numbers to the coefficients? Work out a simple trial case -- show me if you like -- and see if the sines all evaluate to 0, 1, and -1. Some authors like to show how clever they are by exhibiting tricks like that. 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;
Reply by I. R. Khan September 22, 20042004-09-22
Thanks Jerry. I shall wait for your reply in the morning. Here it is 13:30,
i.e. GMT + 9.
The filter I wrote is not IIR. All my questions were about FIR. To say it
simply, the magnitude response has two summations, one has sin(nw) and other
sin(n-1/2)w.

"Jerry Avins" <jya@ieee.org> wrote in message
news:4150fe2a$0$2659$61fed72c@news.rcn.com...
> I. R. Khan wrote: > > > Thanks Jerry once again. Would you please comment on this: > > > > From the filter response > > D(w) = Sum[c(i) Sin(w(i-1/2)), {i = 1: N}] + Sum[d(i) Sin(w i), {i = 1 : > > N}], > > > > it is clear that it is a non linear phase filter. The reason is that to
be
> > linear phase, filter coefficients should be oven/odd symmetric, which > > implies that its magnitude response will be represented by one of the > > followings: > > sin(nw), sin(n-1/2)w, cos(w), cos(n-1/2)w > > > > Is this correct? If yes, then in this case we can say this is a
non-linear
> > phase filter without actually plotting its phase response? > > > > Regards, > > Ishtiaq. > > IIR filters are rarely (never?) linear phase. The condition of symmetric > coefficients yielding linear phase applies to transversal FIR filters. I > don't understand your filter description. Magnitude responses are rarely > trigonometric functions of frequency. It's after midnight. Maybe your > equations and terms will make sense in the morning. > > 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; >
Reply by Jerry Avins September 22, 20042004-09-22
I. R. Khan wrote:

> Thanks Jerry once again. Would you please comment on this: > > From the filter response > D(w) = Sum[c(i) Sin(w(i-1/2)), {i = 1: N}] + Sum[d(i) Sin(w i), {i = 1 : > N}], > > it is clear that it is a non linear phase filter. The reason is that to be > linear phase, filter coefficients should be oven/odd symmetric, which > implies that its magnitude response will be represented by one of the > followings: > sin(nw), sin(n-1/2)w, cos(w), cos(n-1/2)w > > Is this correct? If yes, then in this case we can say this is a non-linear > phase filter without actually plotting its phase response? > > Regards, > Ishtiaq.
IIR filters are rarely (never?) linear phase. The condition of symmetric coefficients yielding linear phase applies to transversal FIR filters. I don't understand your filter description. Magnitude responses are rarely trigonometric functions of frequency. It's after midnight. Maybe your equations and terms will make sense in the morning. 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;
Reply by I. R. Khan September 22, 20042004-09-22
Thanks Jerry once again. Would you please comment on this:

From the filter response
D(w) = Sum[c(i) Sin(w(i-1/2)), {i = 1: N}] + Sum[d(i) Sin(w i), {i = 1 :
N}],

it is clear that it is a non linear phase filter. The reason is that to be
linear phase, filter coefficients should be oven/odd symmetric, which
implies that its magnitude response will be represented by one of the
followings:
sin(nw), sin(n-1/2)w, cos(w), cos(n-1/2)w

Is this correct? If yes, then in this case we can say this is a non-linear
phase filter without actually plotting its phase response?

Regards,
Ishtiaq.

"Jerry Avins" <jya@ieee.org> wrote in message
news:4150f1d8$0$2645$61fed72c@news.rcn.com...
> I. R. Khan wrote: > > > Thanks Jerry. Now I understand the process. Could you please give a > hint (if > > not bit detail) about how to get phase response of this filter: > > > > D(w) = Sum[c(i) Sin(w(i-1/2)), {i = 1: N}] + Sum[d(i) Sin(w i), {i = 1 : > > N}], > > where formulas for c(i) and d(i) are given. > > > > Regards, > > Ishtiaq. > > > There are specific formulas, derived from the Z-transform design methods > to do what you want. Rick Lyons's book "Understanding Digital Signal > Processing" has a good treatment that can give insights to design as > well as analysis. However, if you have decent DSP software tools, you > can simply feed a single positive sample -- all others are zero -- into > the filter and record the impulse response that comes out. An FFT of the > impulse response will give the amplitude and phase responses of the > filter. Amplitude is sqrt(Re[x]+Im[x]), and phase is atan2(Im[z]/Re[x]). > > Jerry > -- > Engineering is the art of making what you want from things you can get. > >
Reply by Jerry Avins September 22, 20042004-09-22
I. R. Khan wrote:

> Thanks Jerry. Now I understand the process. Could you please give a
hint (if
> not bit detail) about how to get phase response of this filter: > > D(w) = Sum[c(i) Sin(w(i-1/2)), {i = 1: N}] + Sum[d(i) Sin(w i), {i = 1 : > N}], > where formulas for c(i) and d(i) are given. > > Regards, > Ishtiaq.
There are specific formulas, derived from the Z-transform design methods to do what you want. Rick Lyons's book "Understanding Digital Signal Processing" has a good treatment that can give insights to design as well as analysis. However, if you have decent DSP software tools, you can simply feed a single positive sample -- all others are zero -- into the filter and record the impulse response that comes out. An FFT of the impulse response will give the amplitude and phase responses of the filter. Amplitude is sqrt(Re[x]+Im[x]), and phase is atan2(Im[z]/Re[x]). Jerry -- Engineering is the art of making what you want from things you can get.
Reply by I. R. Khan September 21, 20042004-09-21
Thanks Jerry. Now I understand the process. Could you please give a hint (if
not bit detail) about how to get phase response of this filter:

D(w) = Sum[c(i) Sin(w(i-1/2)), {i = 1: N}] + Sum[d(i) Sin(w i), {i = 1 :
N}],
where formulas for c(i) and d(i) are given.

Regards,
Ishtiaq.


"Jerry Avins" <jya@ieee.org> wrote in message
news:41502f6e$0$2646$61fed72c@news.rcn.com...
> I. R. Khan wrote: > > I have read some papers about how to calculate filter coefficients. That
is
> > fine. > > > > Then there are some other papers, which just give expressions for the > > frequency response of the filter, and say this is the design. Could any
one
> > please tell me how are these designs useful? My understanding is that to
use
> > these filters, one has to take Fourier Transform of the signal, then > > multiply it with frequency response of filter and then do Inverse > > Transformation. Is this true, or there is some way to find filter > > coefficients from the frequency response of the filter? > > > > A related question: Is the above method of filtering in frequency domain > > less accurate as compared to direct implementation using filter > > coefficients? > > > > Regards, > > Ishtiaq. > > Ishtiaq, > > You haven't understood the papers very well. The filters you read about > operate on the samples directly, not on their Fourier transforms. Each > new sample as it is acquired is used to compute the next output. The > coefficients that puzzle you describe the computation. Read more about > IIR filters. Maybe transversal FIR filters will help you to understand > the process. > > Jerry > -- > Engineering is the art of making what you want from things you can get. > ??????????????????????????????????????????????????????????????????????? >
Reply by Jerry Avins September 21, 20042004-09-21
I. R. Khan wrote:
> I have read some papers about how to calculate filter coefficients. That is > fine. > > Then there are some other papers, which just give expressions for the > frequency response of the filter, and say this is the design. Could any one > please tell me how are these designs useful? My understanding is that to use > these filters, one has to take Fourier Transform of the signal, then > multiply it with frequency response of filter and then do Inverse > Transformation. Is this true, or there is some way to find filter > coefficients from the frequency response of the filter? > > A related question: Is the above method of filtering in frequency domain > less accurate as compared to direct implementation using filter > coefficients? > > Regards, > Ishtiaq.
Ishtiaq, You haven't understood the papers very well. The filters you read about operate on the samples directly, not on their Fourier transforms. Each new sample as it is acquired is used to compute the next output. The coefficients that puzzle you describe the computation. Read more about IIR filters. Maybe transversal FIR filters will help you to understand the process. Jerry -- Engineering is the art of making what you want from things you can get. ???????????????????????????????????????????????????????????????????????