MATLAB: Designing an Arbitrary FIR Filter

designfiltfilterfvtoolsignal processing

I need to design an Arbitrary FIR Filter whose response looks like this,
Frequency = [100 125 160 200 250 315 400 500 630 800 1000 1250 1600 2000 2500 3150 4000 5000 6300 8000 10000]
Required_Filter_Response = [55,38 55,74 52,13 52,64 51,25 49,04 46,50 44,99 42,95 40,73 39,47 37,53 35,36 34,33 32,33 30,36 28,01 25,98 23,19 20,42 18,65]
My professor suggested me using designfilt and fvtool for realizing it. I am not new to MATLAB, but to filters and digital signal processing, I am.
Any suggestions on how to achieve it would be greatly appreciated. Thanks!

Best Answer

This is probably as close as you can get:
Frequency = [100 125 160 200 250 315 400 500 630 800 1000 1250 1600 2000 2500 3150 4000 5000 6300 8000 10000];
Required_Filter_Response = [55.38 55.74 52.13 52.64 51.25 49.04 46.50 44.99 42.95 40.73 39.47 37.53 35.36 34.33 32.33 30.36 28.01 25.98 23.19 20.42 18.65];
Fs = 20000; % Create Sampling Frequency (Not Supplied, Must Be > 20000 Here)
Fn = Fs/2;
Fnew = linspace(min(Frequency), max(Frequency), fix(numel(Frequency)/2)*2);
Rnew = interp1(Frequency, Required_Filter_Response, Fnew);
b = firls(100, Fnew/Fn, Rnew/max(Rnew));
figure
freqz(b, 1, 2^14, Fs)
[h,f] = freqz(b, 1, 2^14, Fs);
figure
plot(Fnew, 20*log10(Rnew/max(Rnew)))
hold on
plot(f, 20*log10(abs(h)))
hold off
Note that the filter and the desired response are essentially the same in the second plot.