Problem with plotting symsum

조회 수: 1 (최근 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 CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by