From: Doug Schwarz on
In article
<93c70a7a-2083-490e-8a82-c4b56267dd8e(a)h30g2000vbr.googlegroups.com>,
Rune Allnor <allnor(a)tele.ntnu.no> wrote:

> On 22 Sep, 13:35, "Alan Kennedy" <alan.ocinne...(a)gmail.com> wrote:
> > �FIR2, as far as I can tell, does not ensure linear phase.
>
> I can agree that the documentation for the function does
> not specifically mention whether it does.
>
> The documentation mentions the 3rd edition of Leland B.
> Jackson's book. I don't have it, but I do have the 2nd
> edition. In the 2nd edition the design goal behind the
> frequency sampling technique is to come up with a linear
> phase FIR filter.
>
> So I think FIR2 could be useful for your task.
>
> Rune


The help info in fir2.m contains the following text:

"The filter B is real, and has linear phase,..."


In any case, it's easy enough to try it and see for yourself:

b = fir2(...);
freqz(b)

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.
From: Rune Allnor on
On 22 Sep, 16:28, Doug Schwarz <s...(a)sig.for.address.edu> wrote:
> In article
> <93c70a7a-2083-490e-8a82-c4b56267d...(a)h30g2000vbr.googlegroups.com>,
>  Rune Allnor <all...(a)tele.ntnu.no> wrote:
>
> > On 22 Sep, 13:35, "Alan Kennedy" <alan.ocinne...(a)gmail.com> wrote:
> > >  FIR2, as far as I can tell, does not ensure linear phase.
>
> > I can agree that the documentation for the function does
> > not specifically mention whether it does.
>
> > The documentation mentions the 3rd edition of Leland B.
> > Jackson's book. I don't have it, but I do have the 2nd
> > edition. In the 2nd edition the design goal behind the
> > frequency sampling technique is to come up with a linear
> > phase FIR filter.
>
> > So I think FIR2 could be useful for your task.
>
> > Rune
>
> The help info in fir2.m contains the following text:
>
>   "The filter B is real, and has linear phase,..."

Maybe it does. I looked at the on-line documentation
available at mathowrks.com. I can't find any mention
of the phase characteristics there.

> In any case, it's easy enough to try it and see for yourself:
>
>   b = fir2(...);
>   freqz(b)

Nope. Don't have the SP toolbox.

Rune
From: Alan Kennedy on
Thanks for your continued interest.

I've been able to design the filter in the analog domain, and convert it into the digital domain via a bilinear transform by using the following MATLAB code:

fg = 300;
fc = 1500;

w_fg = 2*pi*fg;
w_fc = 2*pi*fc;

bl = w_fg;
al = [1 w_fg];

bl2 = w_fc;
al2 = [1 w_fc];

bh = [1 0];
ah = [1 w_fg];

% multiply out numerators and denominators
b_tot = conv(bh, conv(bl, bl2));
a_tot = conv(ah, conv(al, al2));

f_s = 16000;

[b a] = bilinear(b_tot, a_tot, f_s);

figure;
H = freqz(b,a,8001);
plot(linspace(0,1,8001), 20*log10(abs(H)));

The result is a 4th order IIR filter with the appropriate roll-offs applied between eac of the points. (+6dB/oct from 0 to fg, -6 db/oct from fg to fc, -12 db/oct from fc to nyquist)

However, it is not linear phase - one of my initial requirements.

I have looked at FIR2, but can only approximate the exponential roll-off i need - i'd prefer to obtain it some other more straightforward manner. Any suggestions?

Alan
From: Rune Allnor on
On 22 Sep, 19:00, "Alan Kennedy" <alan.ocinne...(a)gmail.com> wrote:
> Thanks for your continued interest.
>
> I've been able to design the filter in the analog domain, and convert it into the digital domain via a bilinear transform by using the following MATLAB code:
....
> However, it is not linear phase - one of my initial requirements.
>
> I have looked at FIR2, but can only approximate the exponential roll-off i need - i'd prefer to obtain it some other more straightforward manner.  Any suggestions?

You can't have both. You will have to decide what is more
important, the linear phase or the exact characteristics
of the frequency response.

Rune
From: Doug Schwarz on
In article <h9avr5$of6$1(a)fred.mathworks.com>,
"Alan Kennedy" <alan.ocinneide(a)gmail.com> wrote:

> Thanks for your continued interest.
>
> I've been able to design the filter in the analog domain, and convert it into
> the digital domain via a bilinear transform by using the following MATLAB
> code:
>
> fg = 300;
> fc = 1500;
>
> w_fg = 2*pi*fg;
> w_fc = 2*pi*fc;
>
> bl = w_fg;
> al = [1 w_fg];
>
> bl2 = w_fc;
> al2 = [1 w_fc];
>
> bh = [1 0];
> ah = [1 w_fg];
>
> % multiply out numerators and denominators
> b_tot = conv(bh, conv(bl, bl2));
> a_tot = conv(ah, conv(al, al2));
>
> f_s = 16000;
>
> [b a] = bilinear(b_tot, a_tot, f_s);
>
> figure;
> H = freqz(b,a,8001);
> plot(linspace(0,1,8001), 20*log10(abs(H)));
>
> The result is a 4th order IIR filter with the appropriate roll-offs applied
> between eac of the points. (+6dB/oct from 0 to fg, -6 db/oct from fg to fc,
> -12 db/oct from fc to nyquist)
>
> However, it is not linear phase - one of my initial requirements.
>
> I have looked at FIR2, but can only approximate the exponential roll-off i
> need - i'd prefer to obtain it some other more straightforward manner. Any
> suggestions?
>
> Alan

Well, you can only get an approximation, but that's all you'll get with
the above method anyway.

You can make it as accurate as you want by using a lot of frequency
points. For example, you can get a very good approximation to what you
did above with

bb = fir2(1000,linspace(0,1,8001)',abs(H));

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.