Error using symengine. Dimensions do not match.

7 visualizzazioni (ultimi 30 giorni)
Juliana Vélez Mesa
Juliana Vélez Mesa il 14 Dic 2020
Risposto: Raunak Gupta il 18 Dic 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

Risposte (1)

Raunak Gupta
Raunak Gupta il 18 Dic 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.

Categorie

Scopri di più su Structures in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by