# Step response and Impulse response of IIR filter

조회 수: 8(최근 30일)
Alex sinWave 2022년 5월 30일
편집: Paul 2022년 5월 31일
Hi,
I am trying to plot the Step response and Impulse response of an IIR filter but I really do not know how as I am not using the designfilt to generate the filter based on frequency-response specifications I am using it as shown in the below code:
temp = Fs/2
Wp = 170/temp; Ws = 220/temp;
[n,Wn]= buttord(Wp, Ws, 4, 8); % getting the order
[z,p,k] = butter(n, Wn, 'low'); % IIR filter
[sos,g] = zp2sos(z, p, k);
y = filtfilt(sos, g, X); % signal after applying the filter
I applied the Step response and Impulse response in an FIR filter successfully as shown below:
h = fir1(100, 170/temp, 'low'); % FIR filter
% Impulse response of digital filter
impz(h)
% Step response of digital filter
stepz(h)
y = filter(h, 1, X);% signal after applying the filter
I can not do the same thing in the IIR filter. what should I do?

댓글을 달려면 로그인하십시오.

### 채택된 답변

Paul 2022년 5월 30일
편집: Paul 2022년 5월 31일
Hi Alex,
It would be helpful to know the value of temp. Absent that, it seem like
[hstep,tstep] = stepz(sos);
hstep = hstep*g;
[himp,timp] = impz(sos);
himp = himp*g;
should work.
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Paul 2022년 5월 30일
Once we have hstep and himp, just plot them.
Fs = 4000; % just making something up
temp = Fs/2;
Wp = 170/temp; Ws = 220/temp;
[n,Wn] = buttord(Wp, Ws, 4, 8); % getting the order
[z,p,k] = butter(n, Wn, 'low'); % IIR filter
[sos,g] = zp2sos(z, p, k);
[hstep,nstep] = stepz(sos);
hstep = hstep*g;
figure
stem(nstep,hstep);
figure
[himp,nimp] = impz(sos);
himp = himp*g;
stem(nimp,himp)

댓글을 달려면 로그인하십시오.

R2015a

### Community Treasure Hunt

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

Start Hunting!

Translated by