Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

how to plot magniture and phase response of a filter?

Asked by LeBron on 10 Apr 2013

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))

0 Comments

LeBron

Tags

Products

No products are associated with this question.

2 Answers

Answer by Teja Muppirala on 10 Apr 2013

You need to do elementwise division, use "./" instead of "/"

Hw=(0.1*(exp(1j*w)-1))./(exp(1j*w)+0.8);

1 Comment

LeBron on 10 Apr 2013

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

Teja Muppirala
Answer by LeBron on 11 Apr 2013

i hope someone replies thx

0 Comments

LeBron

Contact us