From: Steve Pope on
Tim Wescott <tim(a)seemywebsite.com> wrote:

>Make a vector that "draws" the frequency response that you want, then
>take its FFT.
>
>It may not be the entirely kosher way to do it, but it certainly works.

Doesn't this give you a complex filter?

Can you just take the real part afterwards?

Steve
From: robert bristow-johnson on
On Jun 30, 10:39 pm, Tim Wescott <t...(a)seemywebsite.com> wrote:
> On 06/30/2010 06:21 PM, Pete Fraser wrote:
>
>
>
> > I'm new to Matlab, so this is probably a really dumb question.
> > I'm trying to design an FIR where I can set the points.
> > I want a symmetric FIR.
> > I'm assuming that an N tap FIR gives me N/2 degrees of freedom
> > for an even number of taps, and (N + 1)/2 degrees of freedom
> > for an odd number of taps.
> > This should allow me to set the frequency response at a
> > number of points equal to the degrees of freedom, and
> > have the frequency response travel through these points
> > exactly. If I don't specify transitions that are too sharp
> > relative to the number of taps, then the frequency response
> > should be reasonably well controlled between the set points.
>
> > I had assumed that I could use the filter toolbox's freqsamp
> > method to do this, but it doesn't seem to work as I expected.
> > What am I doing wrong? I'd normally do this in Mathematica
> > or C, but I'm trying to get into the spirit of Matlab.
>
> > I would want to solve the point setting problem anyway, but
> > perhaps there's an easier way to do the immediate task that
> > I wanted it for. I want to implement a Butterworth amplitude
> > response in an FIR filter (to emulate some legacy equipment)
> > but I can't find an easy way of doing that in Matlab (hence the
> > point setting experiments).
>
> Make a vector that "draws" the frequency response that you want, then
> take its FFT.
>
> It may not be the entirely kosher way to do it, but it certainly works.

Pete might want to use the "window method". with an iFFT *larger*
than N, draw in the frequency response, he'll get an impulse response
that is longer than N, then window it to length N. (then maybe FFT
back to see how bad the window mangled things.)

r b-j

From: Tim Wescott on
On 06/30/2010 08:10 PM, Steve Pope wrote:
> Tim Wescott<tim(a)seemywebsite.com> wrote:
>
>> Make a vector that "draws" the frequency response that you want, then
>> take its FFT.
>>
>> It may not be the entirely kosher way to do it, but it certainly works.
>
> Doesn't this give you a complex filter?
>
> Can you just take the real part afterwards?

If the desired magnitude response is real and symmetric around the
frequency = 0 bin (element 1 in Matlab's indexing scheme) then the FFT
will be largely real, with only leftover numerical noise in the
imaginary part. If the imaginary part has any weight to it at all, then
you've done something wrong.

Note that you want to be symmetric around frequency = 0 modulo the whole
thing; i.e. for a 256 element vector element 2 should equal element 256
with Matlab-style indexing, element 3 should equal element 255, etc.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" was written for you.
See details at http://www.wescottdesign.com/actfes/actfes.html
From: Steve Pope on
Tim Wescott <tim(a)seemywebsite.com> wrote:

>On 06/30/2010 08:10 PM, Steve Pope wrote:

>> Tim Wescott<tim(a)seemywebsite.com> wrote:

>>> Make a vector that "draws" the frequency response that you want, then
>>> take its FFT.

>>> It may not be the entirely kosher way to do it, but it certainly works.

>> Doesn't this give you a complex filter?

>> Can you just take the real part afterwards?

>If the desired magnitude response is real and symmetric around the
>frequency = 0 bin (element 1 in Matlab's indexing scheme) then the FFT
>will be largely real, with only leftover numerical noise in the
>imaginary part. If the imaginary part has any weight to it at all, then
>you've done something wrong.

That makes sense. Thanks.

Steve
From: Pete Fraser on
"Jerry Avins" <jya(a)ieee.org> wrote in message
news:BdTWn.3387$OU6.1391(a)newsfe20.iad...

> What is so good about a Butterworth amplitude response that you want to
> imitate it?

Nothing.
It's just that, under some circumstances, equipment that is
later in the signal chain expects a Butterworth response.