필터 지우기
필터 지우기

stem function and fft

조회 수: 5 (최근 30일)
Eman Ahmed Elsayed
Eman Ahmed Elsayed 2011년 12월 16일
i used stem function to convert a continuous signal to discrete signal.
and then i want the discrete function to get the fast Fourier transform of it.
stem return a vertical lines only so what should i do with this vertical lines???
I hope that my question was clear.
Thanks,

답변 (1개)

Wayne King
Wayne King 2011년 12월 16일
Hi Eman, stem() is not converting the continuous signal to discrete time. stem() just plots. If you have the sequence (vector) in MATLAB, then it is already a discrete-time sequence.
You want to operate on the vector with the function fft()
% an example
x = cos(pi/4*(0:95));
stem(x);
% now obtain the discrete Fourier transform
xdft = fft(x);
stem(abs(xdft));
  댓글 수: 2
Eman Ahmed Elsayed
Eman Ahmed Elsayed 2011년 12월 16일
Ok. but what's the difference between stem(x) and stem (abs(x))
Wayne King
Wayne King 2011년 12월 16일
The discrete Fourier transform of a vector is (in general) complex-valued, so you want to plot either the magnitudes (abs()), or the phases (angle() )
In the simple example I gave you, the imaginary parts are all zero, but that is not going to be the case with any real-world signal

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by