How do i compare FFT of signals, where Amplitude decreases by increasing sampling time?

조회 수: 1 (최근 30일)
Hey, I want to find out, what a is a good sampling time for multiple sin signals. while comparing the results i came to a strange result: the amplitude (at some signalfrequencies) decreases if increasing the sampling time. a leakage effect obviously, but how do i deal with this? for examle here:
Fs = 1e3;
L1 = 1.00e3; % length 1
L2 = 1.31e3; % length 2
t1 = 0:1/Fs:L1/Fs-1/Fs; % timeperiode1 = 1 sec
x1 = sin(2*pi*320*t1);
t2 = 0:1/Fs:L2/Fs-1/Fs; % timeperiode2 = 1.31 sec
x2 = sin(2*pi*320*t2);
x1dft = 2*fft(x1)/L1; % FFT x1
x2dft = 2*fft(x2)/L2; % FFT x2
fig = figure(1);
hold on
freq1 = 0:Fs/(L1-1):Fs; % frequency resolution = Fs/L
stem(freq1,abs(x1dft), 'r') % plot x1 over frequency
freq2 = 0:Fs/(L2-1):Fs;
stem(freq2,abs(x2dft), 'b') % plot x1 over frequency
ylim([0.90, 1.001]);
xlim([200, 400]);
xlabel('Hz')
ylabel('Amplitude')
hold off
this is a example of one of multiple signal frequencies i want to sample. I have tried different windows, hanning made this effect worse. A Flat-top Window provides good results but at some signalfrequencies the signal sampled a shorter timeperiode is creating the larger amplitude.
Can I take the value of a Testsignal (ideal sin) and scale measured results by this theoretical maximum value or how would you compare these measurment results? I am thankful for some suggestions. regard Tobias

답변 (2개)

Wayne King
Wayne King 2016년 4월 15일
The problem is in your x2 signal, the frequency 320 Hz does not fall in a DFT bin because you data length is 1310 samples and your sampling frequency is 1000 Hz. You can simply pad the FFT so that you interpolate the DFT and now 320 will fall on a bin.
Fs = 1e3;
L1 = 1.00e3; % length 1
L2 = 2000; % length 2
t1 = 0:1/Fs:L1/Fs-1/Fs; % timeperiode1 = 1 sec
x1 = sin(2*pi*320*t1);
t2 = 0:1/Fs:L2/Fs-1/Fs; % timeperiode2 = 1.31 sec
x2 = sin(2*pi*320*t2);
x1dft = 2*fft(x1)/L1; % FFT x1
x2dft = 2*fft(x2,2000)/L2; % FFT x2
fig = figure(1);
hold on
freq1 = 0:Fs/(L1-1):Fs; % frequency resolution = Fs/L
stem(freq1,abs(x1dft), 'r') % plot x1 over frequency
freq2 = 0:Fs/(L2-1):Fs;
stem(freq2,abs(x2dft), 'b') % plot x1 over frequency
ylim([0.90, 1.001]);
xlim([200, 400]);
xlabel('Hz')
ylabel('Amplitude')
hold off

Tobias B.
Tobias B. 2016년 4월 15일
thanks for the response. so zero padding is a solution.
how can i handle unknown measurement signals? Where i don't know the signal frequency. a frequency dependent zero padding seams a bit complicated ...
  댓글 수: 2
J. Webster
J. Webster 2016년 4월 15일
zero padding is NOT a solution in the real world. What you should do is learn about windowing functions and how they reduce effects due to signals not "lining up nicely" at the edges.
Here is a really nice explanation of ffts, you perhaps could just skip down to the section on windowing.
Wayne King
Wayne King 2016년 4월 15일
If you don't know the frequencies, then I agree with J.Webster in principle, you're better off using a good window. I would suggest you look at this example:
as one place to start

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

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by