以下の内容はhttps://seinzumtode.hatenadiary.jp/entry/2021/06/14/000520より取得しました。


複素フーリエ級数

y(t)=|t|, y(t+2π)=y(t) のフーリエ級数展開。(周期T=2π)
有周波数f0=1/T。
以下のようにフーリエ級数展開するとき、
 y=\displaystyle \sum_{-\infty}^{\infty} c_n e^{2\pi f_0 n t}
係数は以下のように計算される。
 c_0=\dfrac{T}{4}
 c_n=\dfrac{2}{T} \cdot \dfrac{(-1)^n-1}{(2 \pi f_0 n)^2}

clear; close all; clc;

T=2*pi;
f0=1/T;
dt=0.01;
t=-T/2:dt:T/2;
c = @(n) 2/T*((-1)^n-1)/(2*pi*f0*n)^2;
c0 = T/4;

f=@(t) abs(t);
y=f(t);
plot(t,y,'DisplayName','original');
hold on;

nmaxs=[1,3,5];
for idx=1:length(nmaxs)
    nmax = nmaxs(idx);
    ft=fourier_series_complex(t,f0,c0,c,nmax);
    plot(t,ft,'DisplayName',sprintf('N=%d',nmax));
end
legend();
big;

function ft=fourier_series_complex(t,f0,c0,c,nmax)
ft = 0;
for n=-nmax:nmax
    if n==0
        cn = c0;
    else
        cn = c(n);
    end
    ft = ft + cn*exp(1j*(2*pi*f0*n)*t);
end
end

f:id:seinzumtode:20210614000512p:plain




以上の内容はhttps://seinzumtode.hatenadiary.jp/entry/2021/06/14/000520より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14