how to see the frequency response of difference equation

Hi I am having the difference equation
y[n] = -0.9y[n-1] +x [n] -x [n-1]
I want to see its frequency response. What should i do
should i first convert it into Z-Form and then proceede Any ideas how to go abt it

 採用された回答

Wayne King
Wayne King 2011 年 12 月 15 日

0 投票

You can do the following:
W = -pi:(2*pi)/8192:pi;
[H,W] = freqz([1 -1],[1 0.9],W);
plot(W,abs(H));

4 件のコメント

moonman
moonman 2011 年 12 月 15 日
So it means he is right
Option D is correct option
Kindly just confirm this and i will close this thread
Thanks a lot for sparing ur precious time for me
Wayne King
Wayne King 2011 年 12 月 15 日
you got it.
Boom
Boom 2016 年 8 月 7 日
How did you get [1 0.9]? Why 1? and why 0.9? I see the equation has a negative 0.9, but not positive 0.9. Thanks
Mike Shane
Mike Shane 2023 年 7 月 27 日
I hope by now you've figured it out, but for those who have the same question here is a simple explanation
y[n] = -0.9y[n-1] +x [n] -x [n-1] is the origianl expression
you have to put y terms on one side and x terms on one side, as below
y[n] + 0.9y[n-1] = x[n] -x[n-1]
now you can take the coefficients of y and x correctly, otherwise you are making a mistake while taking the coefficients
after that you'll get the below,
y has [1 0.9]
x has [1 -1]

サインインしてコメントする。

その他の回答 (4 件)

Wayne King
Wayne King 2011 年 12 月 15 日

0 投票

Hi, here you go. If you want to visualize the magnitude:
fvtool([1 -1],[1 0.9]);
If you want the complex-valued response:
[H,W] = freqz([1 -1],[1 0.9]);
plot(W,abs(H));

2 件のコメント

moonman
moonman 2011 年 12 月 15 日
Hi king thanks
i have plotted it and changed the scale as well in fvtool but not getting the desired option
I have uploaded question here
can u kindly review it
http://www.4shared.com/photo/Y3A4z6qx/question.html
Thanks a lot
moonman
moonman 2011 年 12 月 15 日
plz guide me

サインインしてコメントする。

Wayne King
Wayne King 2011 年 12 月 15 日

0 投票

Hi, that's because your graphs are showing the frequency response over [-pi,pi). You can use the 'whole' option in freqz()
[H,W] = freqz([1 -1],[1 0.9],'whole');
plot(W,abs(H));
moonman
moonman 2011 年 12 月 15 日

0 投票

When i plot by this
[H,W] = freqz([1 -1],[1 0.9],'whole');
W = W-pi;
plot(W,abs(H));
I sm getting the peak magnitude of 20 where as in all options peak is 20. why its so
Anyhow as per ur direction Option 'A' is correct am i right?

4 件のコメント

moonman
moonman 2011 年 12 月 15 日
How can i achieve exact figure like that of book
with pi on x-axis..
Wayne King
Wayne King 2011 年 12 月 15 日
sorry, in my earlier post I made a mistake with the W = W-pi; with the 'whole' option pi radians/sample is in the middle. I've corrected it above.
Wayne King
Wayne King 2011 年 12 月 15 日
the book is wrong, the frequency response in magnitude should be 20 at pi radians/sample and -pi radians/sample
moonman
moonman 2011 年 12 月 15 日
Thanks king for explaining me
So the answer is 'A'. Am i right
but one of my frd has solved it and he is saying answer is D
and in email he wrote me
answer would be D as the value of H(0) = 0
Is he wrong.Plz tell me

サインインしてコメントする。

moonman
moonman 2011 年 12 月 15 日

0 投票

Thanks a lot King People on forum say that i only accept the answer of Wayne King U always explain in such a nice manner and move with me in question till the time i m not satisfied Thanks a lot and may God give u more knowledge so that u can enlighten more people

カテゴリ

質問済み:

2011 年 12 月 15 日

コメント済み:

2023 年 7 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by