Error using symengine. Dimensions do not match.

6 views (last 30 days)
Good afternoon. I'm trying to run this code, but I get this error: Error using symengine. Dimensions do not match. If anyone could help me to solve it I would be so glad.
x=0:1/p:L;
y=0:1/m:L1;
function fn(atr,~)
for i=1:length(y)
M(1,1+(i-1)*length(x):i*length(x))=x;
M(2,1+(i-1)*length(x):i*length(x))=y(i)*ones(1,length(x));
end
for n=1:50
u1=str2sym(get(atr,'string'))
inte=u1*sin(n*pi*x/L)
q = int(inte,0,L)
Dn= 2*q/(L*sinh(n*pi*L1/L))
s=Dn*sinh(n*pi*y/L)*sin(n*pi*x/L)
end
end

Answers (1)

Raunak Gupta
Raunak Gupta on 18 Dec 2020
Hi,
Since there are lot of variables which are not initialized, I am assuming length of vector x and y are different. From the error message I can understand that code works fine till the last line, where
s=Dn*sinh(n*pi*y/L)*sin(n*pi*x/L);
throughs the error because of different size of sinh(n*pi*y/L) and sin(n*pi*x/L). You can make both x and y of same length, this will clear out the error.

Categories

Find more on Structures 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!