フィルターのクリア

I have a problem with plotting a summation equation

1 回表示 (過去 30 日間)
Sherman
Sherman 2012 年 11 月 27 日
The question: For the fuction:
g(x,y) = G=4*sum((1-cos(n*pi)./(n*pi).^3).*exp(-n*pi*x).*sin(n*pi*y)).
y is between 0 and 1 and x is o to .7. We must use increment of 0.05 for x and 0.025 for y and n=25. I have to plot g using mesh(y,x,G). Heres what i got:
X=linspace(0,0.7,14);
Y=linspace(0,1,40);
X=Y.';
[x,y]=meshgrid(X,Y);
for n=1:25;
G=4*sum((1-cos(n*pi)./(n*pi).^3).*exp(-n*pi*x).*sin(n*pi*y));
mesh(G)
end

採用された回答

Mitch Martelli
Mitch Martelli 2012 年 11 月 27 日
編集済み: Mitch Martelli 2012 年 11 月 27 日
Hi, you mean something like that ?
y=0:0.025:1;
x=0:0.05:0.7;
n=1:1:50;
[X,Y]=meshgrid(x,y);
for i=1:size(n,2)
g_n=4*sum(1-cos(n(i)*pi)/(n(i)*pi)^3)*exp(-n(i)*pi*X).*sin(n(i)*pi*Y);
g_xy(:,:,i)=g_n;
end
G=sum(g_xy,3);
mesh(X,Y,G)
  1 件のコメント
Sherman
Sherman 2012 年 11 月 27 日
編集済み: Sherman 2012 年 11 月 27 日
sorry, i wasnt clear, but i have to find the summation for n:0-25. Thanks, this is helping. The assignment says plot g(x,y) using mesh(y,x,g(x,y)).

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by