On 4 Mai, 04:51, "Nasser M. Abbasi" <n...@12000.org> wrote:
> Would this be OK? Or is there another standard format I should be aware of
> for this sort of thing? Any examples I can look at? I've seen many examples
> googling around, but each seems to generate different output, and wanted to
> check if there is a standard one.
As others already said, this as much about art as about anything
else.
I would prefer to keep internal data formats as generic as
possible, and instead derive whatever representations of the
system is required. When I wrote my filter design program I
kept everything represented as biquads internally, and derived
everything else from the biquads. It is far simpler to derive
a frequency response from a set of biquads than the other way
around.
What one ends up with, is a filter design program that designs
the set of biquads, and a set of functions for converting the
biquads to whatever format one wants. If somebody wants a
format you don't already can deliver, all you need to do is
to write nother formatting function.
Very convenient.
Rune
Reply by Tim Wescott●May 4, 20102010-05-04
Nasser M. Abbasi wrote:
> Hello,
>
> I wrote a small program for class to design a low pass digital filter. it is
> an IIR filter designed using Butterworth.
>
> We are given the specifications, and I have generated H(s) and H(z) (using
> impulse invariance, and using bilinear methods).
>
> What is considered as a "standard" output to print as a result of such a
> design run? I am now printing the pole locations for Butterworth and for
> H(z). I also print the spectrums (mag and phase).
>
> I wanted to print H(s), but need to decide the best way to do this. I was
> thinking to print only the coefficients of the denominator polynomial and
> the numerator polynomial for both H(s) and H(z). i.e. write H(s) =
> N(s)/D(s), and H(z)=N(z)/D(z), and make a table listing the power of s or z,
> and the coefficient of this term.
>
> Printing H(s) and H(z) itself is hard to format correctly due to size change
> as order of the filter can change with each run, but printing the
> coefficients only is easier to format as I can make a table, the length of
> table can change, but I have more control of formatting its columns.
>
> Would this be OK? Or is there another standard format I should be aware of
> for this sort of thing? Any examples I can look at? I've seen many examples
> googling around, but each seems to generate different output, and wanted to
> check if there is a standard one.
This is where engineering stops being an applied science and becomes an
art. There is no standard, and there probably shouldn't be. It is up
to you to balance readability aesthetics and coding time to come up with
the best solution for you at this point in time.
Printing the filter coefficients is probably good. For the digital
filter, printing the pole and zero pairs is probably better, because the
pole positions get very sensitive to filter coefficients as the filter
order gets high and (for precisely the same underlying mathematical
reasons) when you implement the filter you'll want to split it into a
cascade of 2nd-order filters.
But as I said -- it's up to you.
--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
Reply by Nasser M. Abbasi●May 3, 20102010-05-03
Hello,
I wrote a small program for class to design a low pass digital filter. it is
an IIR filter designed using Butterworth.
We are given the specifications, and I have generated H(s) and H(z) (using
impulse invariance, and using bilinear methods).
What is considered as a "standard" output to print as a result of such a
design run? I am now printing the pole locations for Butterworth and for
H(z). I also print the spectrums (mag and phase).
I wanted to print H(s), but need to decide the best way to do this. I was
thinking to print only the coefficients of the denominator polynomial and
the numerator polynomial for both H(s) and H(z). i.e. write H(s) =
N(s)/D(s), and H(z)=N(z)/D(z), and make a table listing the power of s or z,
and the coefficient of this term.
Printing H(s) and H(z) itself is hard to format correctly due to size change
as order of the filter can change with each run, but printing the
coefficients only is easier to format as I can make a table, the length of
table can change, but I have more control of formatting its columns.
Would this be OK? Or is there another standard format I should be aware of
for this sort of thing? Any examples I can look at? I've seen many examples
googling around, but each seems to generate different output, and wanted to
check if there is a standard one.
thanks
--Nasser