www.gusucode.com > signal 案例源码程序 matlab代码 > signal/ImpulseResponsesViaPronysMethodExample.m

    %% Filter Responses via Prony's Method
% Fit a 4th-order IIR model to the impulse response of a lowpass filter.
% Plot the original and Prony-designed impulse responses.

% Copyright 2015 The MathWorks, Inc.


%%

d = designfilt('lowpassiir','NumeratorOrder',4,'DenominatorOrder',4, ...
    'HalfPowerFrequency',0.2,'DesignMethod','butter');

impulse_resp = filter(d,[1 zeros(1,31)]);
denom_order = 4;
num_order = 4;
[Num,Den] = prony(impulse_resp,num_order,denom_order);

subplot(2,1,1) 
stem(impz(Num,Den,length(impulse_resp)))
title 'Impulse Response with Prony Design'

subplot(2,1,2)
stem(impulse_resp)
title 'Input Impulse Response'

%%
% Fit a 10th-order FIR model to the impulse response of a highpass filter.
% Plot the original and Prony-designed frequency responses.

d = designfilt('highpassfir', 'FilterOrder', 10, 'CutoffFrequency', .8);

impulse_resp = filter(d,[1 zeros(1,31)]);
num_order = 10;
denom_order = 0;
[Num,Den] = prony(impulse_resp,num_order,denom_order);

fvt = fvtool(Num,Den,d);
legend(fvt,'Prony','Original')