フィルターのクリア

FFT and Fourier series formulas from CSV data file

2 ビュー (過去 30 日間)
Seweryn
Seweryn 2023 年 10 月 31 日
コメント済み: Walter Roberson 2023 年 10 月 31 日
Hi guys, I'm struggling with a problem. I obtained the rms values for ch1 (voltage) and ch2 (current) and performed an FFT analysis in simulink (as you can see in pdf file), but I wonder if I can get the Fourier series formulas for each waveform in Matlab? Values start at line 22 in .csv file (A22:C10021)
I would be delighted to any help.
Kind regards,
Seweryn

採用された回答

Walter Roberson
Walter Roberson 2023 年 10 月 31 日
移動済み: Walter Roberson 2023 年 10 月 31 日
filename = 'tek0005.csv';
data = readmatrix(filename, 'HeaderLines', 21);
time = data(:,1);
T = mean(diff(time));
Fs = 1./T;
L = height(time);
freqs = Fs/L*(0:L-1);
ch1 = data(:,2);
ch2 = data(:,3);
F1 = fft(ch1);
F2 = fft(ch2);
tiledlayout('flow');
nexttile();
plot(freqs, abs(F1)); title('ch1');
xlabel("f (Hz)"); ylabel("|fft(ch1)|")
nexttile();
plot(fftshift(abs(F1))); title('shifted ch1');
nexttile();
plot(freqs, abs(F2)); title('ch2');
xlabel("f (Hz)"); ylabel("|fft(ch2)|")
nexttile();
plot(fftshift(abs(F2))); title('shifted ch2');
  2 件のコメント
Seweryn
Seweryn 2023 年 10 月 31 日
編集済み: Seweryn 2023 年 10 月 31 日
Hi @Walter Roberson, thank you so much for your help, I'm also wondering if we can get a trigonometric Fourier series with appropriate coefficients for each waveform? Something like the picture below. Thank you in advance!
Walter Roberson
Walter Roberson 2023 年 10 月 31 日
https://en.m.wikipedia.org/wiki/Euler%27s_formula
now consider exp(i*x + c) where c is real.
Each entry in the fft output is a complex number so using the equivalence you can separate into sin and cos components.
There will be thousands of these components unless you are willing to say that if abs() of a component is less than a tolerance then you want to consider the component to be effectively 0.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by