Plotting IIR filter error
이전 댓글 표시
I have an IIR filter I am trying to plot, but I am not sure what I am doing wrong here. Can someone please help?
My code:
%% This is a first part of an exercise.
% Here you are implementing the transfer function H(z).
% Pass different values of theta and r to have differnt outcome.
clc; clear all;
%% Part -1 simulation
% initialize r
r = 0.99 ;
%initialize theta
theta = pi/3 ;
% initialize omega vector. Let, ω to start from 0 to pi with % 200 intermediate values.
w = 200 ;
% Now, define z = e^(j*w).
z = exp(1i*w);
% implement H
H = 1./(1 - (2*r*cos(theta)*(z.^-1))+((r^2)*(z.^-2)));
% Now, plot the filter magnitude response in dB scale w.r.t w.
figure;plot(w, );grid on;
xlabel('normalized frequency'); ylabel('amplitude in dB')
title('Frequency and phase response at r = and theta = ');
댓글 수: 2
Star Strider
2019년 11월 2일
What result are you supposed to get, and what result are you getting?
Nathan Jaqua
2019년 11월 2일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Digital and Analog Filters에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!