MATLAB Answers

Arbitrary response Filterbuilder Amplitude question

3 views (last 30 days)
tony karamp
tony karamp on 31 Jan 2014
Edited: Wayne King on 31 Jan 2014
Hello all,
currently I am trying to create an Arbitrary Response filter using filterbuilder. So I open filterbuilder, select the Arbitrary Response Filter. In the Main tab I set Impulse Response to FIR, Order of 200 and Filter Type Single-rate. In the Response Specifications the number of bands is 1, I have specified the response as Amplitudes and the Frequency units are set to Hz. I set the Input Fs equal to 48000Hz. As far as frequency is concerned, I have a vector with values
freq = [12.500 16.000 20.000 25.000 31.500 40.000 50.000 63.000...
80.000 100.000 125.000 160.000 200.000 250.000 315.000 400.000...
500.000 630.000 800.000 1000.00 1250.00 1600.00 2000.00 2500.00...
3150.00 4000.00 5000.00 6300.00 8000.00 10000.0 12500.0 16000.0 20000.0];
I also have the corresponding dB SPL vector
dB = [108.8 104.5 111.4 116.2 116.5 114.7 122.4 130.8...
127.2 133.4 129.6 137.2 136.0 137.5 136.6 136.2...
134.0 135.0 133.7 133.8 133.1 132.6 131.8 131.9...
132.3 131.2 131.6 131.6 132.9 131.4 127.6 124.1 125.2];
Now, back in filterbuilder I use the freq vector as the Frequencies input. What should I be using for the Amplitude input? I know that I can't use the dB SPL vector as is.
Thank you all very much in advance.

  0 Comments

Sign in to comment.

Accepted Answer

Wayne King
Wayne King on 31 Jan 2014
Edited: Wayne King on 31 Jan 2014
Tony, You're incorrect about the frequency vector, it must begin at 0 and end with Fs/2
I've shown you already how to convert dB SPL to amplitudes:
dB = [108.8 108.8 104.5 111.4 116.2 116.5 114.7 122.4 130.8...
127.2 133.4 129.6 137.2 136.0 137.5 136.6 136.2...
134.0 135.0 133.7 133.8 133.1 132.6 131.8 131.9...
132.3 131.2 131.6 131.6 132.9 131.4 127.6 124.1 125.2];
A = sqrt(db2pow(dB));
A is now your amplitude vector. Note that I simply repeated the entry for 12.5 Hz for the necessary 0 frequency value.
Now for your frequency vector, it must begin with 0 and end with Fs/2.
F = [0 12.500 16.000 20.000 25.000 31.500 40.000 50.000 63.000...
80.000 100.000 125.000 160.000 200.000 250.000 315.000 400.000...
500.000 630.000 800.000 1000.00 1250.00 1600.00 2000.00 2500.00...
3150.00 4000.00 5000.00 6300.00 8000.00 10000.0 12500.0 16000.0 24000.0];
You can paste the F and the A vector into the Workspace and then put those variables F and A in the Arbitrary Response Design dialog, or simply use the code I gave you in my first answer which does exactly what filterbuilder does from the command line.
Thank you for accepting my answer if I have helped you.
If you want you can try to have a first frequency element not equal to 0 and a last element not equal to Fs/2, but it will errror.

  0 Comments

Sign in to comment.

More Answers (1)

Wayne King
Wayne King on 31 Jan 2014
Edited: Wayne King on 31 Jan 2014
Are these power measurements in dB?
In other words are these A^2 measurements where A is the desired amplitude?
In that case, you can just use:
dB = [108.8 108.8 104.5 111.4 116.2 116.5 114.7 122.4 130.8...
127.2 133.4 129.6 137.2 136.0 137.5 136.6 136.2...
134.0 135.0 133.7 133.8 133.1 132.6 131.8 131.9...
132.3 131.2 131.6 131.6 132.9 131.4 127.6 124.1 125.2];
A = sqrt(db2pow(dB));
But the first element of your frequency vector must be 0 and the last element must be the Nyquist.
I'll just repeat the value for 12.5 in my example:
F = [0 12.500 16.000 20.000 25.000 31.500 40.000 50.000 63.000...
80.000 100.000 125.000 160.000 200.000 250.000 315.000 400.000...
500.000 630.000 800.000 1000.00 1250.00 1600.00 2000.00 2500.00...
3150.00 4000.00 5000.00 6300.00 8000.00 10000.0 12500.0 16000.0 24000.0];
d = fdesign.arbmag('N,F,A',200,F,A,48000);
Hd = design(d);

  1 Comment

tony karamp
tony karamp on 31 Jan 2014
Hello Wayne and thank you for taking the time to answer me. The measurements are in dB Sound Pressure Level (dB SPL). The two vectors were created in Easera software and I took the info for the frequency and the SPL. I read somewhere that I have to convert the dB SPL vector into amplitude (so I just use 20*log10(dB)?) and then insert that vector to the Amplitude slot of the filter. As for the frequency, I don't believe it has to start from zero, rather just monotonically increase.
Thank you!

Sign in to comment.