How to get the filter coefficients in the double format.

I'm using the fdesign.parameq() function to make an equalizer. In order to automate the filter generation process, I would like to assign the coefficients that the design() funktion produces to variables. However, the coefficients in the sosMatrix are somewhat truncated. I want to get those coefficients in the double format. I cannot find a way to do this. Does someone have a solution to this?
Thank's

回答 (2 件)

Walter Roberson
Walter Roberson 2013 年 2 月 27 日

0 投票

Did you try giving the command
format long g
at the command line, and then displaying the values?
Honglei Chen
Honglei Chen 2013 年 2 月 27 日

0 投票

Do you want to simply display or you want the coefficients themselves? If you want only the display, then Walter's solution above will do, if you want the coefficients themselves, then you can access those number by
d = fdesign.parameq('N,Flow,Fhigh,Gref,G0,GBW,Gst',4,.3,.5,0,-12,-10,-1);
Hd = design(d,'cheby2');
sosmat = Hd.sosMatrix
sval = Hd.ScaleValues

2 件のコメント

Lugo Teehalt
Lugo Teehalt 2013 年 2 月 27 日
I appreciate your attempt to help, but what I want is to assign those coefficients to variables, so I can write a program that creates a C header file. But the thing is that those coefficients are truncated. I want to assign those coeffs in double format to a Matlab variable or array. Of course fcfwrite will create a file, but there will be a lot of files then, since I surely will need about 500 or so.
Honglei Chen
Honglei Chen 2013 年 2 月 27 日
sosmat and sval is the variable you need. They look truncated only because your display format is short. If you do what Walter mentions above, they will show the full precision. Try the following command
format long g
sosmat
sval
Then you can copy them to your header file.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeAudio Processing Algorithm Design についてさらに検索

質問済み:

2013 年 2 月 27 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by