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


フーリエ級数

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

clear; close all; clc;

f = @(t) abs(t);
T=2*pi;
f0=1/T;
dt=0.01;
t=-T/2:dt:T/2;
y=f(t);
plot(t,y,'r','DisplayName','original');
hold on;

a0=T/2;
a=@(n) 4/T*((-1)^n-1)/(2*pi*f0*n)^2;
b=@(n) 0;

% nmax=10;
ns=[1,3,5];
for idx=1:length(ns)
nmax = ns(idx);   
yt=fourier_series(t,f0,a0,a,b,nmax);
plot(t,yt,'--','DisplayName',sprintf('N=%d',nmax));
end

legend();
xlim([-1,1]);
big;

function ft=fourier_series(t,f0,a0,a,b,nmax)
ft = a0/2;
for n=1:nmax
    an = a(n);
    bn = b(n);
    ft = ft + an*cos(2*pi*f0*n*t) + bn*sin(2*pi*f0*n*t);
end

end

f:id:seinzumtode:20210613171650p:plain




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

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