Initilize a Symbolic Toolbox array

1 view (last 30 days)
Philosophaie
Philosophaie on 30 Jun 2013
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

Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!