How can i modify this code?

1 次查看(过去 30 天)
Darsana P M
Darsana P M 2017-4-2
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 个评论
Star Strider
Star Strider 2017-4-2
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.

请先登录,再进行评论。

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by