MATHEMATICA里面定义傅里叶级数,几个问题不懂n1 = 100; a1 = Table[1/\[Pi] NIntegrate[f[x] Cos[i x],{x,-\[Pi],\[Pi]}],{i,0,n1}]; b1 = Table[1/\[Pi] NIntegrate[f[x] Sin[i x],{x,-\[Pi],\[Pi]}],{i,n1}]; Clear[x]; g1 = a[[1]]/2 + Sum[a1[[i + 1
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/13 07:29:20
MATHEMATICA里面定义傅里叶级数,几个问题不懂n1 = 100; a1 = Table[1/\[Pi] NIntegrate[f[x] Cos[i x],{x,-\[Pi],\[Pi]}],{i,0,n1}]; b1 = Table[1/\[Pi] NIntegrate[f[x] Sin[i x],{x,-\[Pi],\[Pi]}],{i,n1}]; Clear[x]; g1 = a[[1]]/2 + Sum[a1[[i + 1
MATHEMATICA里面定义傅里叶级数,几个问题不懂
n1 = 100; a1 =
Table[1/\[Pi] NIntegrate[f[x] Cos[i x],{x,-\[Pi],\[Pi]}],{i,0,
n1}]; b1 =
Table[1/\[Pi] NIntegrate[f[x] Sin[i x],{x,-\[Pi],\[Pi]}],{i,
n1}]; Clear[x]; g1 =
a[[1]]/2 + Sum[a1[[i + 1]] Cos[i x] + b1[[i]] Sin[i x],{i,n1}]; j =
a1[[1]]/2 + Sum[a1[[i + 1]] Cos[i x] + b1[[i]] Sin[i x],{i,n1}];
以上程序我老师写的.为什么要CLEAR?为什么要TABLE?为什么打两个中括号?
MATHEMATICA里面定义傅里叶级数,几个问题不懂n1 = 100; a1 = Table[1/\[Pi] NIntegrate[f[x] Cos[i x],{x,-\[Pi],\[Pi]}],{i,0,n1}]; b1 = Table[1/\[Pi] NIntegrate[f[x] Sin[i x],{x,-\[Pi],\[Pi]}],{i,n1}]; Clear[x]; g1 = a[[1]]/2 + Sum[a1[[i + 1
CLEAR 是把以前定义的量给去掉, 免得影响你这次写的程序!
table 是表格,在这里你可以看成矩阵. 这样你才可以有求和
a[[1]]/2 + Sum[a1[[i + 1]] Cos[i x] + b1[[i]] Sin[i x], {i, n1}]; j =
a1[[1]]/2 + Sum[a1[[i + 1]] Cos[i x] + b1[[i]] Sin[i x], {i, n1}]
自己可以找本Mathematica 的书看看!