Why receive Error using sub2ind (line 73) Out of range subscript. Error in sym/subsref?

3 ビュー (過去 30 日間)
Mehdi
Mehdi 2022 年 12 月 15 日
回答済み: Torsten 2022 年 12 月 15 日
Where is the problem in my codes that I faced error?
M=1;
a=[1,1,1,1]
b=[1];
h=1;
WW=rand(10,10,4,M)
syms eta1 zeta1 eta2 zeta2 eta3 zeta3 eta4 zeta4
ro=1;
F000=zeros(4,M);
F000=sym('F000');
for e=1:4
for r=1:M
F000(e,r)=sym('0');
for i=1:10
for j=10
Cm(1,r)=4/(ro*(a(1))^2*(b(1))^2*h*vpaintegral(vpaintegral((WW(i,j,1,r)* ...
legendreP(i-1, zeta1)*legendreP(j-1, eta1))^2,zeta1,-1,1),eta1,-1,1)); %Normilization coef for plate 1
Cm(2,r)=4/(ro*(a(2))^2*(b(1))^2*h*vpaintegral(vpaintegral((WW(i,j,2,r)* ...
legendreP(i-1, zeta2)*legendreP(j-1, eta2))^2,zeta2,-1,1),eta2,-1,1)); %Normilization coef for plate 2
Cm(3,r)=4/(ro*(a(3))^2*(b(1))^2*h*vpaintegral(vpaintegral((WW(i,j,3,r)* ...
legendreP(i-1, zeta3)*legendreP(j-1, eta3))^2,zeta3,-1,1),eta3,-1,1)); %Normilization coef for plate 3
Cm( 4 , r ) = 4/(ro*(a( 4 ))^2*(b(1))^2*h*vpaintegral(vpaintegral((WW(i,j,4,r)* ...
legendreP(i-1, zeta4)*legendreP(j-1, eta4))^2,zeta4,-1,1),eta4,-1,1)); %Normilization coef for plate 4
W( i , j , e , r ) = Cm(e,r) * WW(i,j,e,r);
F000( 1 , r ) = W( i, j , 1 , r ) * legendreP( i-1 , zeta1 ) * legendreP( j-1 , eta1 ) + F000( 1 , r );
F000( 2 , r ) = W( i, j , 2 , r ) * legendreP( i-1 , zeta2 ) * legendreP( j-1 , eta2 ) + F000( 2 , r );
F000( 3 , r ) = W( i, j , 3 , r ) * legendreP( i-1 , zeta3 ) * legendreP( j-1 , eta3 ) + F000( 3 , r );
F000( 4 , r ) = W( i, j , 4 , r ) * legendreP( i-1 , zeta4 ) * legendreP( j-1 , eta4 ) + F000( 4 , r );
end
end
end
end
Error using sub2ind (line 73)
Out of range subscript.
Error in sym/subsref (line 992)
R_tilde = sub2ind(size(L), Idx.subs{:});

採用された回答

Torsten
Torsten 2022 年 12 月 15 日
I hope you know what you are doing ...
M=1;
a=[1,1,1,1];
b=[1];
h=1;
WW = rand(10,10,4,M);
W = zeros(10,10,4,M);
W = sym(W);
syms eta1 zeta1 eta2 zeta2 eta3 zeta3 eta4 zeta4
ro=1;
F000=zeros(4,M);
F000=sym(F000);
for e=1:4
for r=1:M
for i=1:10
for j=10
Cm(1,r)=4/(ro*(a(1))^2*(b(1))^2*h*vpaintegral(vpaintegral((WW(i,j,1,r)* ...
legendreP(i-1, zeta1)*legendreP(j-1, eta1))^2,zeta1,-1,1),eta1,-1,1)); %Normilization coef for plate 1
Cm(2,r)=4/(ro*(a(2))^2*(b(1))^2*h*vpaintegral(vpaintegral((WW(i,j,2,r)* ...
legendreP(i-1, zeta2)*legendreP(j-1, eta2))^2,zeta2,-1,1),eta2,-1,1)); %Normilization coef for plate 2
Cm(3,r)=4/(ro*(a(3))^2*(b(1))^2*h*vpaintegral(vpaintegral((WW(i,j,3,r)* ...
legendreP(i-1, zeta3)*legendreP(j-1, eta3))^2,zeta3,-1,1),eta3,-1,1)); %Normilization coef for plate 3
Cm( 4 , r ) = 4/(ro*(a( 4 ))^2*(b(1))^2*h*vpaintegral(vpaintegral((WW(i,j,4,r)* ...
legendreP(i-1, zeta4)*legendreP(j-1, eta4))^2,zeta4,-1,1),eta4,-1,1)); %Normilization coef for plate 4
W( i , j , e , r ) = Cm(e,r) * WW(i,j,e,r);
F000( 1 , r ) = W( i, j , 1 , r ) * legendreP( i-1 , zeta1 ) * legendreP( j-1 , eta1 ) + F000( 1 , r );
F000( 2 , r ) = W( i, j , 2 , r ) * legendreP( i-1 , zeta2 ) * legendreP( j-1 , eta2 ) + F000( 2 , r );
F000( 3 , r ) = W( i, j , 3 , r ) * legendreP( i-1 , zeta3 ) * legendreP( j-1 , eta3 ) + F000( 3 , r );
F000( 4 , r ) = W( i, j , 4 , r ) * legendreP( i-1 , zeta4 ) * legendreP( j-1 , eta4 ) + F000( 4 , r );
end
end
end
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by