MATLAB: Arbitrary response Filterbuilder Amplitude question

amplitudearbitrarydbfilterfilterbuilderfrequencyspl

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.

Best Answer

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.