Initilize a Symbolic Toolbox array

1 次查看(过去 30 天)
Philosophaie
Philosophaie 2013-6-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 CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by