Harmonic current by using FFT
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
OMAR MOUSA
il 15 Nov 2021
Risposto: Star Strider
il 15 Nov 2021
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);
0 Commenti
Risposta accettata
Star Strider
il 15 Nov 2021
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.
.
0 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!