Error using symengine. Dimensions do not match.

23 vues (au cours des 30 derniers jours)
Juliana Vélez Mesa
Juliana Vélez Mesa le 14 Déc 2020
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

Réponses (1)

Raunak Gupta
Raunak Gupta le 18 Déc 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.

Community Treasure Hunt

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

Start Hunting!

Translated by