Digital Signal Processing Reference
In-Depth Information
Mit der MATLAB-Function firplot([1 2 4],'test') wurde die Anzeige
in Bild 9-5 erzeugt.
Machen Sie sich mit den MATLAB-Befehlen roots , zplane , unwrap und
grpdelay vertraut.
Programmbeispiel 9-1 Grafische Darstellung des Pol-Nullstellendiagramms, der
Impulsantwort, der Frequenzgänge des Betrags, der Phase und der
Gruppenlaufzeit und der Dämpfung von FIR Systemen
% Pole-zero plot and plot of the magnitude, the attenuation,
% the phase and the group delay of a FIR system
% function firplot(h,txt)
% h : impulse response of FIR system
% txt : text string for figure title
% firplot.m * mw * 04/24/2008
function firplot(h,txt)
if nargin==2
NAME = ['firplot : ',txt];
% add text to the figure title
else
NAME = 'firplot';
end
FIG = figure('Name',NAME,'NumberTitle','off');
% Impulse response
subplot(3,2,1), stem(0:length(h)-1,h,'full'), grid
xlabel('{\itn} \rightarrow'), ylabel('{\ith}[{\itn}] \rightarrow')
% Pn-plot
subplot(3,2,2), zplane(h,[1 zeros(1,length(h)-1)]), grid
xlabel('Re \rightarrow'), ylabel('Im \rightarrow')
% Magnitude of frequency response
N = 1024; % number of samples in the frequency domain
H = fft(h,max(N,length(h)));
f = 0:N-1; f = 2*f/N;
f = f(1:N/2); H = H(1:N/2);
subplot(3,2,4), plot(f,abs(H)), grid
xlabel('\Omega / \pi \rightarrow'), ylabel('|{\itH}(e^{j\Omega})|
\rightarrow')
% Attenuation of frequency response
subplot(3,2,6), plot(f,min(-20*log10(abs(H)),100)), grid
xlabel('\Omega / \pi \rightarrow')
ylabel('{\ita}(\Omega) in dB \rightarrow')
% Phase of frequency response
subplot(3,2,3), plot(f,angle(H)/pi), grid
xlabel('\Omega / \pi \rightarrow')
ylabel('{\itb}(\Omega) / \pi \rightarrow')
% Group delay
[tau,w] = grpdelay(h,[1 zeros(1,length(h)-1)],N,'whole');
w = w(1:N/2); tau = tau(1:N/2);
subplot(3,2,5), plot(w/pi,tau), grid
xlabel('\Omega / \pi \rightarrow')
ylabel('{\it{\tau}}_{\itg}(\Omega) \rightarrow')
Search WWH ::




Custom Search