フィルターのクリア

Harmonic current by using FFT

10 ビュー (過去 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 Center および File ExchangeSpectral Measurements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by