ReSpeaker DSP V02
Dependencies: mbed MbedJSONValue
Matlab_Script/ArbMagFilterDesign.txt
- Committer:
- Arkadi
- Date:
- 2019-06-20
- Revision:
- 14:8a4699aa69b5
- Parent:
- 1:574b54755983
File content as of revision 14:8a4699aa69b5:
function [MyFilter, sos, g] = ArbMagFilterDesign(Nb, Na) % For iirlpnorm filter description see http://www.mathworks.com/help/dsp/ref/iirlpnorm.html % Nb Numerator Order % Na Denominator Order P = [2 128]; % P'th norm dens = 20; % Density Factor % Frequency Vector - normalized % Real frequences = F * (Fs/2) wher Fs is sampling frequency F = [0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1.0]; % Amplitudas A = [0 0 0 0 1 1 1.1 1.1 1.1 1.1 1.2 1.2 1.2 1.2 1.2 1.3 1.3 1.3 1.4 1.4 1.4]; % Amplitude Vector % Weights has one entry per frequency point (the same length as f and a) which tells iirlpnorm how % much emphasis to put on minimizing the error in the vicinity of each frequency point relative to the other points. W = [0.1 0.1 0.1 0.1 ones(1,17)]; % Frequency Edges, normalized (single band) E = [0 1]; % Hints % % This is a weighted least-pth optimization. % Check the radii and locations of the poles and zeros for your filter (with zplane function). If the zeros are on the unit circle % and the poles are well inside the unit circle, try increasing the order of the numerator or reducing the error weighting in the stopband. % Similarly, if several poles have a large radii and the zeros are well inside of the unit circle, try increasing the order % of the denominator or reducing the error weighting in the passband. [num,den,err,sos,g] = iirlpnorm(Nb, Na, F, E, A, W, P, {dens}); MyFilter = dfilt.df1sos(sos, g); end