>
>andrewunm wrote:
>>
>> I tried plotting the gain using the semilogx function, but I did not

see

>> the symmetry I described above.
>
>can you post a code snippet?
>
>> I took two courses in DSP, and we plotted
>> many filter responses without consideration of frequency warping. In

fact

>> it was never mentioned.
>
>was "bilinear transform" mentioned? if your BPF resonant frequency is
>much below Nyquist (at least 2 or 3 octaves), the effect of frequency
>warping is negligible. at least usually it is.
>
>r b-j
>

>

Yes, the bilinear transform was mentioned multiple times. I think that
was to transform an analog filter into a digital filter. After I created
H (the filter gain) using code from my first post, I typed
semilogx(abs(H), hoping to plot the magnitude of the frequency response.
Andrew

Reply by robert bristow-johnson●November 2, 20062006-11-02

andrewunm wrote:

>
> I tried plotting the gain using the semilogx function, but I did not see
> the symmetry I described above.

can you post a code snippet?

> I took two courses in DSP, and we plotted
> many filter responses without consideration of frequency warping. In fact
> it was never mentioned.

was "bilinear transform" mentioned? if your BPF resonant frequency is
much below Nyquist (at least 2 or 3 octaves), the effect of frequency
warping is negligible. at least usually it is.
r b-j

Reply by andrewunm●November 2, 20062006-11-02

>
>andrewunm wrote:
>
>>
>> Thanks for the tip. Let me clarify what I meant by symmetry. Let's

say

>> we have a bandpass filter like I described above centered at a

frequency

>> fc, and we plot the frequency response. Would I be correct in

expecting

>> to see a mirror image symmetry around the center frequency?
>
>sure. but you should expect that for *any* BPF displayed as gain vs.
>log of frequency (for continuous-time or "analog" filters, there is
>some frequency warping for digital filters that is not visible if your
>center frequency is much lower than Nyquist).
>
>the symmetry comes from the mapping of the LPF prototype to BPF such
>that (in the s-domain):
>
>H_b(s) = H_l(s+1/s)
>
>when s = j*w then
>
>H_b(jw) = H_l(jw+1/(jw)) = H_l(j*(w-1/w)) = H_l( j*(w^2-1)/w) )
>
>so you can see that the BPF does at w=1 what the LPF does at w=0. now
>if you express that in terms of log(w) it's
>
>H_b(j*exp(log(w)) ) = H_l( j*(exp(log(w)-1/exp(log(w)) ) = H_l(
>j*(exp(log(w)-exp(-log(w)) )
>
> = H_l( j*2*(sinh(log(w)) )
>
>that is why there is symmetry in log(w).
>
>r b-j
>
>

I tried plotting the gain using the semilogx function, but I did not see
the symmetry I described above. I took two courses in DSP, and we plotted
many filter responses without consideration of frequency warping. In fact
it was never mentioned.
Andrew

Reply by robert bristow-johnson●November 1, 20062006-11-01

andrewunm wrote:

>
> Thanks for the tip. Let me clarify what I meant by symmetry. Let's say
> we have a bandpass filter like I described above centered at a frequency
> fc, and we plot the frequency response. Would I be correct in expecting
> to see a mirror image symmetry around the center frequency?

sure. but you should expect that for *any* BPF displayed as gain vs.
log of frequency (for continuous-time or "analog" filters, there is
some frequency warping for digital filters that is not visible if your
center frequency is much lower than Nyquist).
the symmetry comes from the mapping of the LPF prototype to BPF such
that (in the s-domain):
H_b(s) = H_l(s+1/s)
when s = j*w then
H_b(jw) = H_l(jw+1/(jw)) = H_l(j*(w-1/w)) = H_l( j*(w^2-1)/w) )
so you can see that the BPF does at w=1 what the LPF does at w=0. now
if you express that in terms of log(w) it's
H_b(j*exp(log(w)) ) = H_l( j*(exp(log(w)-1/exp(log(w)) ) = H_l(
j*(exp(log(w)-exp(-log(w)) )
= H_l( j*2*(sinh(log(w)) )
that is why there is symmetry in log(w).
r b-j

Reply by andrewunm●November 1, 20062006-11-01

>
>andrewunm wrote:
>> Greetings,
>>
>> I am exploring Butterworth filters on Matlab. I created the filter
>> weights using:
>> [b,a]=butter(8,[.6438 .9328]);
>>
>> Now, I want to plot the gain of the filter using the following code

given

>> below. I plotted the gain using plot(abs(H)). I do not see symmetry

in

>> the plot.
>
>i dunno what you mean by "symmetry" w.r.t. Butterworth filters, but
>i'll bet you want to use the MATLAB function "semilogx()" instead of
>"plot()".
>
>r b-j
>
>

Thanks for the tip. Let me clarify what I meant by symmetry. Let's say
we have a bandpass filter like I described above centered at a frequency
fc, and we plot the frequency response. Would I be correct in expecting
to see a mirror image symmetry around the center frequency?
Andrew

Reply by robert bristow-johnson●November 1, 20062006-11-01

andrewunm wrote:

> Greetings,
>
> I am exploring Butterworth filters on Matlab. I created the filter
> weights using:
> [b,a]=butter(8,[.6438 .9328]);
>
> Now, I want to plot the gain of the filter using the following code given
> below. I plotted the gain using plot(abs(H)). I do not see symmetry in
> the plot.

i dunno what you mean by "symmetry" w.r.t. Butterworth filters, but
i'll bet you want to use the MATLAB function "semilogx()" instead of
"plot()".

Reply by robert bristow-johnson●November 1, 20062006-11-01

andrewunm wrote:

> Greetings,
>
> I am exploring Butterworth filters on Matlab. I created the filter
> weights using:
> [b,a]=butter(8,[.6438 .9328]);
>
> Now, I want to plot the gain of the filter using the following code given
> below. I plotted the gain using plot(abs(H)). I do not see symmetry in
> the plot.

i dunno what you mean by "symmetry" w.r.t. Butterworth filters, but
i'll bet you want to use the MATLAB function "semilogx()" instead of
"plot()".
r b-j

Reply by andrewunm●November 1, 20062006-11-01

Greetings,
I am exploring Butterworth filters on Matlab. I created the filter
weights using:
[b,a]=butter(8,[.6438 .9328]);
Now, I want to plot the gain of the filter using the following code given
below. I plotted the gain using plot(abs(H)). I do not see symmetry in
the plot. My co-worker created a similar Butterworth filter using a
different technique, and his plot shows symmetry. Is it required that the
plot show symmetry, indicating I did something wrong?
Thanks for your thoughts,
Andrew
function [H,nu]=gain(b,a,N)
% [H,nu]=gain(b,a,N)
%
% H =N values of complex gain of a linear digital system.
% nu =N frequencies in [0,0.5] Hz-s at which H values are computed.
% N is set internally to 513 unless specified.
% H and nu are both column vectors.
% b =numerator weights of linear system transfer function.
% a =denominator weights. a(1) must not be 0. Usually, a(1)=1.
%
% b and a can be arrays. If so, each row contains the weights of a
% section of the digital transfer function in cascade form.
if(nargin<3),
N=513;
end
% Check for errors.
[mb,nb]=size(b);
[ma,na]=size(a);
if(mb~=ma),
error('b and a arrays must have the same # of rows.');
elseif(min(abs(a(:,1)))==0)
error('a cannot have a zero in its first column.');
end
% Go thru H(z) one section at a time. fft size =2(N-1).
N2=2*(N-1);
H=ones(1,N2);
for m=1:mb,
A=fft([a(m,:),zeros(1,N2-na)]);
if(min(abs(A))==0),
error('Power gain is infinite at some point.');
end
H=H.*fft([b(m,:),zeros(1,N2-nb)])./A;
end
% Specify nu and H(nu).
nu=linspace(0,.5,N)';
H=H(1:N)';