Matlab filter responce and magnitude of filter question. I have been working on this HW and...

60.1K

Verified Solution

Question

Electrical Engineering

Matlab filter responce and magnitude of filter question.

I have been working on this HW and I am not sure if I didsomething wrong. Here is my code.

%y[n]=x[n]+x[n-1]-x[n-4]-x[n-5];

%y[n]=y[n-1]-.9*y[n-2]+x[n]+x[n-1]

clear

clc

[x,fs] = audioread('toto.wav');

x = x(:,1);

dt = 1/fs;

t = 0:dt:(length(x)*dt)-dt;

plot(t,x); xlabel('Seconds'); ylabel('Amplitude');

num=[1 1 -.9];

den=[1 1 0 0 -1 -1];

sys=tf(num,den);

k=filter(num,den,x);

subplot(3,1,1);

plot(t,k);

title('filter response');

w=0:0.001:pi;

[h,om]=freqz(num,den,w)

m=20*log10 (abs(h))

an=angle(h)

subplot(3,1,2)

plot(om/pi,m)

title('mag spectrum of filter')

xlabel('freq')

ylabel('mag in db')

subplot(3,1,3)

plot(om/pi,an)

title('phase spectrum of filter')

xlabel('freq')

So I was playing around and when I use the 2nd equation at thetop like in this code my filter response or the magnitude don'tchange. Why is that? Did I do something wrong? It doesn't evenchange if I change the values of the den either.

Answer & Explanation Solved by verified expert
3.6 Ratings (539 Votes)
Dear userI think you are doing mistake in num den remaining code seemsto be goodFor this equation ynxnxn1xn4xn5use num1 1 0 0 0 1 1den1For other equationusenum1 1 den1 1 09When    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students