What changes should I make to save the values of P? P should at least be a 2×2 matrix!!
2 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Andrei Bobrov
on 14 Mar 2016
n = (1:2:19)';
t = n*pi/b;
P = [n, cumsum(c*sin(t*x).*sinh(t*y)./sinh(t*a)./n)];
0 Comments
Walter Roberson
on 14 Mar 2016
P(k,:) = [n, sum];
Note: do not name a variable "sum", as that interferes with the key MATLAB routine "sum"
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!