Filter löschen
Filter löschen

How can i modify this code?

1 Ansicht (letzte 30 Tage)
Darsana P M
Darsana P M am 2 Apr. 2017
Kommentiert: Star Strider am 2 Apr. 2017
I would like to obtain 16 bank filters obtained in the below program using direct form 2 filters in iir. What modifcaton should i do?
Fs = 22050; % Samping Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency
pf = linspace(20,4000,17); % Passband Frequencies
%pf=[20 100:100:2E+4];
cf = pf(1:end-1)+(pf(2)-pf(1))/2; % Centre Frequencies
for k1 = 1:length(cf)
[z(:,k1),p(:,k1),k(k1)] = butter(7, [pf(k1) pf(k1+1)]/Fn);
[sos{k1},g{k1}] = zp2sos(z(:,k1),p(:,k1),k(k1));
[h(:,k1),w(:,k1)] = freqz(sos{k1},512,Fs);
end
figure(1)
plot(w([1 16],:), abs(h([1 16],:)))
grid
% axis([0 0.2 ylim])
figure(2)
freqz(sos{1})
hold on
for k1 = 2:16
freqz(sos{k1})
%Sf(k1,:) =filtfilt(sos{k1},g{k1},S);
end
hold off
  1 Kommentar
Star Strider
Star Strider am 2 Apr. 2017
To use them in a Direct Type II configuration, you have to realize the filters as transfer functions, not second-order-section matrices. You need the numerator and denominator polynomials.
I haven’t done anything with Direct Form filters since graduate school (back in the Precambrian). I do not remember them fondly.
I’m not posting this as an Answer because it isn’t one.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Digital and Analog Filters finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by