Harmonic current by using FFT

6 次查看(过去 30 天)
Hi all,
I'm new in matlab and i need help how to write a code for harmonics current (1,3,5,7) by using FFT, I wrote some codes but the problem is how can i get the harmonics if i have time serie of data??
I attached the code that i got
data_all=xlsread('main reading-day1-1sec');
x=data_all(:,10);
%%Signal in Time-domain for x
fs=1/1; %sampling freq
ts=1/fs; %sampling time
L=length(x); %length of the signal (x)
t=(0:L-1)/fs; %the time require for block data t=N/fs ot t=N*ts
%Signal in Frequency-domain for x
fhs_fin = zeros(L,1);
NEFT=2^nextpow2(L); % Next power of 2 from length of x
x_fft=abs(fft(x,NEFT));
freq=fs/2*linspace(0,2,NEFT+1/2);

采纳的回答

Star Strider
Star Strider 2021-11-15
That looks like it should work, although for the most accurrate results, divide ‘x_fft’ by the row size of ‘x’ or since it is a column vector, ‘L’. If ‘data_all’ has a time vector, first be certain that it is sampled regularly and consistently, and then use it to define the frequency vector to use with theFourier transfoorm plot.
The findpeaks function will probably help identify the harmonic peaks.
.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by