Error using symengine. Dimensions do not match.

19 次查看(过去 30 天)
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

回答(1 个)

Raunak Gupta
Raunak Gupta 2020-12-18
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.

类别

Help CenterFile Exchange 中查找有关 Number Theory 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by