Initilize a Symbolic Toolbox array
조회 수: 1 (최근 30일)
이전 댓글 표시
I am getting an error in line:
Gup=sym(zeros(2,2))
I am trying to initilize a Symbolic Toolbox array. This equation has worked for me in the past.
Here is the error code:
??? Subscript indices must either be real positive integers or logicals.
Error in ==> CoAndContraMetricTensors at 5
Gup=sym(zeros(2,2))
Here is my m-file program:
syms a_1 a_2 a_3 aup1 aup2 aup3 g_11 g_12 g_13 g_21 g_22 g_23 g_31 g_32 g_33
A_k=[a_1; a_2; a_3]
Aupk=[aup1; aup2; aup3]
g_=[g_11 g_12 g_13; g_21 g_22 g_23; g_31 g_32 g_33]
Gup=sym(zeros(2,2))
G=det(g_)
for i=1:3
p=i+1
if p>3 then
p=p-3
end
r=p+1
if r>3 then
r=r-3
end
for k=1:3
s=k+1
if s>3 then
s=s-3
end
t=s+1
if t>3 then
t=t-3
end
Gup(i,k)=[g_(p,s) g_(p,t);g_(r,s) g_(r,t)]
end
end
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!