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

조회 수: 2 (최근 30일)
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 CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by