필터 지우기
필터 지우기

signal processing, fft, adding two cosine waves

조회 수: 6 (최근 30일)
Nani C
Nani C 2012년 5월 6일
Hi, I can individually retrieve the magnitude and frequency of two cosine waves (say 10*cos(w*t) and 30*cos(w*t)). Suppose the signal is 10*cos(w*t)+30*cos(w*t) how to retrieve the magnitudes (i.e, 10 and 30) from the fft. All suggestions welcome.

채택된 답변

Wayne King
Wayne King 2012년 5월 6일
Then the magnitude will be 40 in this case if the frequencies and phases are the same. And there is no way to extract the 10 and the 30 separately.
n = 0:199;
x = 10*cos(pi/4*n)+30*cos(pi/4*n);
xdft = fft(x);
xdft = xdft(1:length(x)/2+1)/length(x);
xdft(2:end-1) = 2*xdft(2:end-1);
plot(abs(xdft))
abs(xdft(26))

추가 답변 (1개)

Wayne King
Wayne King 2012년 5월 6일
The main thing will be figuring out the DFT bin that the frequency of interest falls on. The frequencies are spaced at Fs/N where N is the length of the input signal and Fs is the sampling frequency. Keep in mind that the first bin (unless you use fftshift) is the zero frequency, or DC. I'll do an example assuming a sampling frequency of 1 and two frequencies, 1/8 cycles/sec and 1/4 cycles per second. For a signal of length 200, we expect these frequencies in bins, 26 and 51.
n = 0:199;
x = 10*cos(pi/4*n)+30*sin(pi/2*n);
xdft = fft(x);
xdft = xdft(1:length(x)/2+1)/length(x);
xdft(2:end-1) = 2*xdft(2:end-1);
plot(abs(xdft))
abs(xdft(26))
abs(xdft(51))
  댓글 수: 1
Nani C
Nani C 2012년 5월 6일
O.K. what about when both frequencies are same ?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by