借助一个关于二元带求和的函数的画图。

16 ビュー (過去 30 日間)
jicope
jicope 2022 年 11 月 21 日
回答済み: hodef 2022 年 11 月 21 日
图中a=2;x=-2:.2:2;
y=-2:.2:2;
[X,Y]=meshgrid(x,y);
t=[0:1:100];
Z=0.96./(pi.^3).*sum((1./((2.*n-1).^3))*cos((2.*n-1)*pi.*Y)*sin((2.*n-1).*pi.*X/2));
mesh(X,Y,Z)
这个代码总是提示错误,求高人解答

採用された回答

hodef
hodef 2022 年 11 月 21 日
直接修改你的代码如下:
x=-2:.1:2;
t=-2:.1:2;
[X,T]=meshgrid(x,t);
n=reshape(0:1:100,1,1,[]);
Z = 0.96./(pi.^3).*sum(bsxfun(@times, 1./(2*n-1).^3, cos(bsxfun(@times, (2*n-1)*pi, T)).*sin(bsxfun(@times, (2*n-1)*pi, X/2))),3);
surf(X,T,Z)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics and Optimization についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!