How do i compare FFT of signals, where Amplitude decreases by increasing sampling time?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (2)
Wayne King
le 15 Avr 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 commentaires
Tobias B.
le 15 Avr 2016
2 commentaires
J. Webster
le 15 Avr 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
le 15 Avr 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
Voir également
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!