필터 지우기
필터 지우기

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 CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by