《DSP using MATLAB》示例Example7.12

代码:
M = 21; alpha = (M-1)/2; n = [0:1:M-1]; 
hd = (cos(pi*(n-alpha)))./(n-alpha); hd(alpha+1) = 0;
w_ham = (hamming(M))'; 
h = hd .* w_ham;
[Hr, w, c, L] = Hr_Type3(h);  
%Plot
figure('NumberTitle', 'off', 'Name', 'Exameple 7.12')
set(gcf,'Color','white'); 
subplot(2,2,1); stem(n, hd); axis([-1 M -1.2 1.2]); grid on;
xlabel('n'); ylabel('hd(n)'); title('Ideal Impulse Response');
subplot(2,2,2); stem(n, w_ham); axis([-1 M 0 1.2]); grid on;
xlabel('n'); ylabel('w(n)'); title('Hamming Window');
subplot(2,2,3); stem(n, h); axis([-1 M -1.2 1.2]); grid on;
xlabel('n'); ylabel('h(n)'); title('Actual Impulse Response');
subplot(2,2,4); plot(w/pi, Hr/pi); axis([0 1 0 1]); grid on;
xlabel('frequency in pi units'); ylabel('slope in pi units'); title('Amplitude Response');
运行结果:

    牢记:
1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号