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

조회 수: 11(최근 30일)
Tobias B. 15 Apr 2016
Commented: Wayne King 15 Apr 2016
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

로그인 to comment.

### 답변 수 (2)

Wayne King 15 Apr 2016
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

#### 댓글 수: 0

로그인 to comment.

Tobias B. 15 Apr 2016
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 15 Apr 2016
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 15 Apr 2016
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

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by