What changes should I make to save the values of P? P should at least be a 2×2 matrix!!
2 ビュー (過去 30 日間)
古いコメントを表示
this is the code:
for k=1:10
n=2*k-1
a1=sin((n*pi.*x)/b);
a2=sinh(n*pi.*y/b);
a3=n*sinh(n*pi*a/b);
sum=sum+c.*a1.*a2/a3;
P=[n, sum]
end
0 件のコメント
回答 (2 件)
Andrei Bobrov
2016 年 3 月 14 日
n = (1:2:19)';
t = n*pi/b;
P = [n, cumsum(c*sin(t*x).*sinh(t*y)./sinh(t*a)./n)];
0 件のコメント
Walter Roberson
2016 年 3 月 14 日
P(k,:) = [n, sum];
Note: do not name a variable "sum", as that interferes with the key MATLAB routine "sum"
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!