What changes should I make to save the values of P? P should at least be a 2×2 matrix!!

2 ビュー (過去 30 日間)
merey
merey 2016 年 3 月 14 日
回答済み: Walter Roberson 2016 年 3 月 14 日
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

回答 (2 件)

Andrei Bobrov
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)];

Walter Roberson
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"

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by