how to plot magniture and phase response of a filter?

3 次查看(过去 30 天)
Hey everyone heres the question: http://img42.imageshack.us/img42/3236/capturezih.jpg I cant seem to get the plots to work
Heres my matlab code
w=0:0.001:pi;
Hw=(0.1*(exp(1j*w)-1))/(exp(1j*w)+0.8);
figure (1)
subplot (2,1,1)
plot(w,abs(Hw))
subplot (2,1,2)
plot(w,angle(Hw))

回答(2 个)

Teja Muppirala
Teja Muppirala 2013-4-10
You need to do elementwise division, use "./" instead of "/"
Hw=(0.1*(exp(1j*w)-1))./(exp(1j*w)+0.8);
  1 个评论
LeBron
LeBron 2013-4-10
thx for replying that worked.
One more question related to the same question: http://img23.imageshack.us/img23/7905/capturelc.jpg
if true
n=1:5:100;
x=cos(15*pi*2/16)+ 2;
figure (2)
subplot(2,1,1)
stem(n,x)
ylabel('x(n)')
y=filter([
subplot(2,1,2)
stem(n,y)
ylabel('y(n)')
xlabel('n')
end
just not sure what to use in yfilter part. thx

请先登录,再进行评论。


LeBron
LeBron 2013-4-11
i hope someone replies thx

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by