'IIR filter'에 해당되는 글 1

  1. 2008.05.13 DSP_homework02

DSP_homework02

clear all; close all;
warning('off','MATLAB:dispatcher:InexactMatch')
% 2nd Homework 'Make some of IIR filter'
% #1
% (a)For Ex 6-1, draw |H(Ω)| and |H(Ω)| [dB]
w= 0:0.001:pi;
z= exp(j*w);
N= 0:23;
% (b) For input x[n]= cos(pi*n/6) + cos(pi*n/2) , n=0,1,2,…..23
% Draw |X(Ω)|, |Y(Ω)| where Y(Ω)= X(Ω)*H(Ω)

[A_Y, A_in_H, DB, A_H] = hw2(2, z, cos((pi/6)*N)+cos((pi/2)*N), 3142);

figure('name', '#1', 'Position', [100, 150, 800, 600], 'MenuBar', 'none')
subplot(2,2,1); plot(A_H); title('Response H(Ω)'); hold on;
subplot(2,2,2); plot(DB); title('Response in dB'); grid; ylabel('Decibels');
subplot(2,2,3); plot(A_in_H); title('Response X(Ω)');
subplot(2,2,4); plot(A_Y); title('Response Y(Ω)');

% #2
% (a)Passband centered at Ω=pi/4 with a BW of pi/40 between -3dB points
% Peak gain is unity
% Perfect rejection at Ω=0 and Ω= pi/2
% (b) For input x[n]= cos(pi*n/6) + cos(pi*n/2) , n=0,1,2,…..23
% Draw |X(Ω)|, |Y(Ω)| where Y(Ω)= X(Ω)*H(Ω)
[A_Y, A_in_H, DB, A_H] = hw2(4, z, cos((pi/6)*N)+cos((pi/2)*N), 3142);

figure('name', '#2', 'Position', [150, 100, 800, 600], 'MenuBar', 'none')
subplot(2,2,1); plot(A_H); title('Response H(Ω)'); hold on;
subplot(2,2,2); plot(DB); title('Response in dB'); grid; ylabel('Decibels');
subplot(2,2,3); plot(A_in_H); title('Response X(Ω)');
subplot(2,2,4); plot(A_Y); title('Response Y(Ω)');

% % #3
% % Ex 6-2 draw |H1(Ω)|, |H2(Ω)|, |H(Ω)|
H1= 1./(z.^2-1.9476.*z*cos(pi/10)+0.9483);
H2= z.^2-2.*z*cos(pi/10)+1;
H3= H1.*H2;
figure('name', '#3 |H1(Ω)|, |H2(Ω)|, |H(Ω)|', 'Position', [200, 50, 800, 600], 'MenuBar', 'none')
subplot(2,2,1); plot(abs(H1)); title('Response H1(Ω)'); hold on;
subplot(2,2,2); plot(abs(H2)); title('Response H2(Ω)');
subplot(2,1,2); plot(abs(H3)); title('Response H(Ω)');

'예외처리' 카테고리의 다른 글

DSP_homework03  (0) 2008.05.13
DSP_homework01  (0) 2008.05.13
우사비치  (4) 2008.02.06