From: Pete Fraser on
"Vladimir Vassilevsky" <nospam(a)nowhere.com> wrote in message
news:OP-dnf44bO7hJ7HRnZ2dnUVZ_t-dnZ2d(a)giganews.com...

> Check the FDLS method of Greg Berchin. That is one of the most elegant
> methods of designing to a prototype.

I think I must be doing something dumb.
I started off with a really simple half-band FIR, just
as a test.

The input file was:

11 100000
0 1 0 1
5000 1 -72 1
10000 1 -144 1
15000 1 -216 1
20000 1 -288 1
25000 .5 -360 1
30000 0 -432 1
35000 0 -504 1
40000 0 -576 1
45000 0 -648 1
50000 0 -720 1


N=8
D=0
delta=0

and I get B =


-3.55068459956424e-018
-0.0454056666613377
2.42666919829597e-016
0.292936161872951
0.5
0.326331656363899
-2.00804673259988e-016
-0.0874864446451108
-1.76118166519034e-017

so it's doing a lot of things right.

The center is 0.5, four are close to 0,
but 0.29 is not 0.32, and -0.04 is not -0.08.

What am I doing wrong?

Thanks

Pete


From: Greg Berchin on
On Thu, 1 Jul 2010 18:48:22 -0700, "Pete Fraser" <pfraser(a)covad.net> wrote:

>I think I must be doing something dumb.
>I started off with a really simple half-band FIR, just
>as a test.
....
>The center is 0.5, four are close to 0,
>but 0.29 is not 0.32, and -0.04 is not -0.08.
>
>What am I doing wrong?

You are expecting a generic least-squares fit to produce a symmetric filter,
without telling the algorithm to expect symmetry. If you know that your filter
is symmetric, you should constrain FDLS to guarantee it:

Standard FDLS formulation (set up for zero-order denominator):

-1 -n
b + b z + ... + b z
y(z) 0 1 n
---- = -----------------------
u(z) 1


Constrained formulation:

-1 -(n-1) -n
b + b z + ... + b z + b z
y(z) 0 1 1 0
---- = -----------------------------------
u(z) 1

Greg
From: Greg Berchin on
In fact, if you know that your filter is halfband (every other coefficient is
zero), you should also constrain for that:

Standard FDLS formulation (set up for zero-order denominator):

-1 -n
b + b z + ... + b z
y(z) 0 1 n
---- = -----------------------
u(z) 1

Constrained formulation:

-2 -(n-2) -n
b + b z + ... + b z + b z
y(z) 0 2 2 0
---- = -----------------------------------
u(z) 1

Always try to use as much information as as you have.

Greg
From: Pete Fraser on
"Greg Berchin" <gberchin(a)comicast.net.invalid> wrote in message
news:uchr26djlcjnmrmvi4k94ue126i7sf9vov(a)4ax.com...

> You are expecting a generic least-squares fit to produce a symmetric
> filter,
> without telling the algorithm to expect symmetry.

I thought I was doing that be specifying a linear phase response but,
of course, the FDLS is just using the phase response as a goal.
It can do a better match for my requested amplitude response by
using an asymmetric kernel, so it does.
Is that correct?

> If you know that your filter
> is symmetric, you should constrain FDLS to guarantee it:

I'm using version 2.0 (10/21/2006) and I don't see any way
of constraining the filter to be symmetrical (or will I need to
tweak the code)?

Thanks for a nice tool and tutorial.

Pete


From: Greg Berchin on
On Fri, 2 Jul 2010 09:46:15 -0700, "Pete Fraser" <pfraser(a)covad.net> wrote:

>I thought I was doing that be specifying a linear phase response but,
>of course, the FDLS is just using the phase response as a goal.
>It can do a better match for my requested amplitude response by
>using an asymmetric kernel, so it does.
>Is that correct?

It's just a pseudoinverse and it's just data. Truncation and rounding,
numerical ill-conditioning, etc., all affect the result.

Also, you are trying to identify nine coefficients with only eleven data points.
It should be sufficient, but give it some more data to work with anyway.

>I'm using version 2.0 (10/21/2006) and I don't see any way
>of constraining the filter to be symmetrical (or will I need to
>tweak the code)?

The Matlab code is only intended to be a starting point, an introductory
example. The possibilities for variations on FDLS are limitless. So modify the
code to fit your specific problem. I won't mind!

>Thanks for a nice tool and tutorial.

You're welcome.

Greg