Harmonic current by using FFT
9 ビュー (過去 30 日間)
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
%%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
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.