How can I draw the transfer function spectra by matlab?

20 ビュー (過去 30 日間)
Anna
Anna 2022 年 9 月 26 日
コメント済み: Sam Chak 2022 年 9 月 27 日
  4 件のコメント
Paul
Paul 2022 年 9 月 27 日
編集済み: Paul 2022 年 9 月 27 日
Yes, the fact that "spectra" is plural adds uncertainty into the question. Do you think spectra/spectrum has "something to [do] with the frequency response" or do you think it is the frequency response? FWIW, I'm more inclined to refer to the spectrum of a signal, not a a system (unless the spectrum of a system is just the spectrum of its impulse response?).
Sam Chak
Sam Chak 2022 年 9 月 27 日
I remember that when we want to analyze the frequency content of a signal, the term "signal spectrum" is often used, and we usually plot the signal amplitude vs. its corresponding frequency. Almost similar to what is shown here:
Perhaps the question asks to show the spectrum of the signal coming out from the digital filter. Let @Anna to clarify.

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

回答 (1 件)

Star Strider
Star Strider 2022 年 9 月 26 日
The ‘spectrum’ is the Bode plot:
z = tf('z');
H = 5 / (1 + 2*cos(5)*z^-1 + z^-2);
H.Variable = 'z^-1'
H = 5 ---------------------- 1 + 0.5673 z^-1 + z^-2 Sample time: unspecified Discrete-time transfer function.
figure
bodeplot(H)
grid
See the documentation on bode and bodeplot for details.
.
  2 件のコメント
Anna
Anna 2022 年 9 月 26 日
can you explain for me the line H.Variable = 'z^-1'
thank you!!
Star Strider
Star Strider 2022 年 9 月 26 日
That selects how the variable is formatted. See the documentation section on Variable for a full explanation.
Also, I am assuming here that you are implementing a discrete control system. If instead you are coding a digital filter. the freqz function is most appropriate —
b = [5 0 0 0];
a = [1 2*cos(5) 1 0];
figure
freqz(b, a, 2^16)
% set(subplot(2,1,1), 'XScale','log') % Optional
% set(subplot(2,1,2), 'XScale','log') % Optional
.

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

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by