Problem with plotting symsum

2 ビュー (過去 30 日間)
Jacob Andréasson
Jacob Andréasson 2019 年 11 月 7 日
回答済み: Kavya Vuriti 2019 年 11 月 12 日
syms n X Y
[X]=meshgrid(0:0.1:6);
[Y]=meshgrid(0:0.1:10);
F1=(8/(pi^2))*symsum((1/(n^2))*sin(n*pi/2)*cos(n*pi*Y/6)*sin(n*pi*X/6),n,1,100);
plot3(X,Y,F1)
This is the script that i have written but i get the following error codes:
Error using symengine
Array sizes must match.
Error in sym/privBinaryOp (line 1032)
Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});
Error in .* (line 316)
X = privBinaryOp(A, B, 'symobj::zipWithImplicitExpansion', '_mult');
Error in myscript (line 5)
F1=(8/(pi^2)).*symsum((1/(n^2)).*sin(n.*pi/2).*cos(n.*pi.*Y/6).*sin(n.*pi.*X/6),n,1,100);
How could i solve this problem?

回答 (1 件)

Kavya Vuriti
Kavya Vuriti 2019 年 11 月 12 日
Hi,
I noticed that the dimensions of arrays being multiplied does not match. According to the code provided, the term cos(n*pi*Y/6) yields symbolic array of dimension 101 x 101 and the term sin(n*pi*X/6) yields symbolic array of dimension 61 x 61. You can ensure that the dimensions of X and Y are compatible for multiplication. Also, you can try appending ones to make dimensions consistent if you are using element wise multiplication instead of matrix multiplication.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by