Error using symengine. Dimensions do not match.

7 ビュー (過去 30 日間)
Juliana Vélez Mesa
Juliana Vélez Mesa 2020 年 12 月 14 日
回答済み: Raunak Gupta 2020 年 12 月 18 日
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 Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by