推 sweetycool:感恩,不過我設m=∞時顯示出的數值還是亂碼 04/25 15:02
※ 引述《sweetycool (tina)》之銘言:
: http://ppt.cc/QKcl
: 想問一下這樣的分段週期函數,可以用mathmatica算出來嗎?
: 謝謝
Clear[f, a0, an, bn]
f[t_] = UnitStep[t] - UnitStep[t - 1];
a0 = f[0]
an = FourierCosCoefficient[f[t], t, n,
FourierParameters -> {-1, \[Pi]}]
bn = FourierSinCoefficient[f[t], t, n,
FourierParameters -> {-1, \[Pi]}]
m = 11;
F[t_] = a0/2 + \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 1\), \(m\)]\(an\ Cos[
n\ \[Pi]\ t]\)\) + \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 1\), \(m\)]\(bn\ Sin[
n\ \[Pi]\ t]\)\)
Plot[{f[t], F[t]}, {t, -2, 3}, AspectRatio -> Automatic]
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.109.112.96
※ 文章網址: http://www.ptt.cc/bbs/Mathematica/M.1398343408.A.C8C.html
※ 編輯: Frobenius (140.109.112.96), 04/24/2014 20:52:07