Problem with FFT plot
Mostrar comentarios más antiguos
I have measurements of time and current which were made with a digital oscilloscope. When I import them in MATLAB and plot them my sinewave is pretty much like my the waveform I saw in the oscilloscope and in the excel file (time domain).

The problem is that, when i try to apply fft to my data, i'm taking this waveform as a result.

I think, that i should see my only harmonic in 50Hz, since there is a 50Hz sinewave taken as an input. Instead I'm taking a nearly zero harmonic. I think that I probably haven't understood something quite well here and I'm getting really confused about my problem.Can anyone help me?
Here is my code:
t=xlsread('C:\Users\Riko\Documents\MATLAB\Meas_V5_L2','A2:A10001');
I=xlsread('C:\Users\Riko\Documents\MATLAB\Meas_V5_L2','C2:C10001');
figure(1)
plot(t,I,'r');
xlabel('time (s)')
ylabel('current(A)')
grid on
N = 2^nextpow2(length(I));
Y = fft(I,N);
Fs = 5000; %Sampling frequency z
f = Fs/2*linspace(0,1,N);
p = abs(Y)/N; %Power of signal figure(2)
plot(f,p)
Thanks, in advance!
Respuesta aceptada
Más respuestas (2)
Joseph Cheng
el 5 de Jun. de 2015
I totally agree you really need to explain what you want to see. here is a quick sample using the multitude of FFT examples out there on the internet.
f = 50; %frequency of sinewave
fs=50000; %sampling frequency
x = -.025:1/fs:.025;
y = 2.25*sin(2*pi*f*(x+.007))+.1*rand(size(x))-.2;
figure(1),subplot(1,3,1),plot(x,y); %mimic of your example
title(['Sine Wave f=', num2str(f), 'Hz']);
xlabel('Time(s)');
ylabel('Amplitude');
NFFT=2.^nextpow2(numel(y));
Y=fftshift(fft(y,NFFT));
fVals=fs*(-NFFT/2:NFFT/2-1)/NFFT;
subplot(1,3,2),plot(fVals,abs(Y),'b');
title('Double Sided FFT - with FFTShift');
xlabel('Frequency (Hz)')
ylabel('|DFT Values|');
xlim([-100 100])
NFFT=2.^nextpow2(numel(y)*10); %10x to "increase" the spectral resolution
Y=fftshift(fft(y,NFFT));
fVals=fs*(-NFFT/2:NFFT/2-1)/NFFT;
subplot(1,3,3),plot(fVals,abs(Y),'b');
title('Double Sided FFT - with FFTShift "increase in spectral resolution"');
xlabel('Frequency (Hz)')
ylabel('|DFT Values|');
xlim([-100 100])
1 comentario
Rikos Verikokos
el 6 de Jun. de 2015
Alternatively, i simulated your code using t as simple sine wave. either try to load I individually and check its output, as it could be a case your variable I being filled of dummy value. use clc;clear;
Categorías
Más información sobre Spectral Measurements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
