Harmonic current by using FFT

조회 수: 13 (최근 30일)
OMAR MOUSA
OMAR MOUSA 2021년 11월 15일
답변: Star Strider 2021년 11월 15일
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에서 Transforms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by