MATLAB中如何进行级数求和例如

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 14:39:45

MATLAB中如何进行级数求和例如
MATLAB中如何进行级数求和
例如

MATLAB中如何进行级数求和例如
+∑sin(ny)*sin(nx),其中n由1到20,要画出z关于x,y(假设x=1;50;y=1:50)
syms x y
n=1:20;
z=sin(y)+sum(sin(n*y).*sin(n*x))
[x,y]=meshgrid(1:50,1:50);
z=subs(z);
mesh(x,y,z)
结果:
z =
sin(y)+sin(y)*sin(x)+sin(2*y)*sin(2*x)+sin(3*y)*sin(3*x)+sin(4*y)*sin(4*x)+sin(5*y)*sin(5*x)+sin(6*y)*sin(6*x)+sin(7*y)*sin(7*x)+sin(8*y)*sin(8*x)+sin(9*y)*sin(9*x)+sin(10*y)*sin(10*x)+sin(11*y)*sin(11*x)+sin(12*y)*sin(12*x)+sin(13*y)*sin(13*x)+sin(14*y)*sin(14*x)+sin(15*y)*sin(15*x)+sin(16*y)*sin(16*x)+sin(17*y)*sin(17*x)+sin(18*y)*sin(18*x)+sin(19*y)*sin(19*x)+sin(20*y)*sin(20*x)