I'm trying to solve christoffel symbol in Matlab. Code is not working.
8 ビュー (過去 30 日間)
古いコメントを表示
syms th d alpha a th1 th2 l1 l2 lc1 lc2 I1x I1y I2x I2y I1z I2z m1 m2 Gamma
D=[m1*lc1^2+m2*(l1^2+lc2^2+2*lc2*l1*cos(th2))+I1z+I2z m2*(lc2^2+l1*lc2*cos(th2))+I2z; m2*(lc2^2+l1*lc2*cos(th2))+I2z m2*(lc2^2)+I2z];
d(1,1)=D(1,1); d(1,2)=D(1,2); d(2,1)=D(2,1); d(2,2)=D(2,2);
n=2;
for gamma = 1:n
for beta = 1:n
for alpha = 1:n
Gamma (gamma, beta, alpha) = 0.5 * ...
(diff (d(alpha, beta), th(gamma)) + ...
diff (d(alpha, gamma), th(beta)) - ...
diff (d(gamma, beta), th(alpha)));
end
end
end
Gamma (:, :, gamma)
0 件のコメント
回答 (2 件)
Elizabeth Reese
2017 年 12 月 6 日
I believe this is just an issue with trying to index into a symbolic value that was not declared as a vector. I was able to run this by adding the following line between the assignment to n and the loops.
th = sym('th',[n,1]);
You can do the same type of creation for Gamma to eliminate the warning about Gamma changing size each iteration.
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!