次の問題があります。オイラー角の大きな配列を回転行列に変換するコードを開発しました。私のデータは、次のような phi1、phi、および phi2 の値です。
phi1 phi phi2
2 3 5
1 2.2 4.3
3 4 5
...他にも 200 万個のデータ配列があります。
しかし、オイラー角の最初の行から形成された回転行列の逆を実行し、それを2行目から展開された行列に掛けたいと思います。次に、結果の行列の要素の 1 つを使用する必要があります。それを行う方法はありますか?
g_11=((cosd(phi1).*cosd(phi2))-(sind(phi1).*sind(phi2).*cosd(phi)));
g_12=((sind(phi1).*cosd(phi2))+(cosd(phi1).*sind(phi2).*cosd(phi)));
g_13= (sind(phi2).*sind(phi));
g_21 =((-cosd(phi1).*sind(phi2))-(sind(phi1).*cos(phi2).*cos(phi)));
g_22 = ((-sin(phi1).*sind(phi2))+(cosd(phi1).*cosd(phi2).*cosd(phi)));
g_23 = (cosd(phi2).*sind(phi));
g_31 = (sind(phi1).* sind(phi));
g_32 = -cosd(phi1).* sind(phi);
g_33 = cosd(phi);
g1 =[g_11 g_12 g_13 ; g_21 g_22 g_23 ; g_31 g_32 g_33]
ここで、g1 は、データの 2 行目の回転行列である g2 を見つけたいデータの最初の行の回転行列です。薄くしたい
del_g= inv(g1).*g2;
次に、結果の行列の g11 要素と g13 要素を抽出します。
データは、次のデータを含むテキスト ファイルから取得されます。
4.55686 0.88751 4.71368 0.00000 0.00000 879.7 0.143 1.77 1 1 Iron - Alpha
4.57459 0.87938 4.71205 20.00000 0.00000 926.3 0.196 2.13 1 1 Iron - Alpha
4.57459 0.87938 4.71205 40.00000 0.00000 550.3 0.196 2.13 1 1 Iron - Alpha
4.57709 0.88250 4.71319 60.00000 0.00000 631.4 0.232 1.85 1 1 Iron - Alpha
4.57507 0.88371 4.72148 80.00000 0.00000 639.7 0.375 2.10 1 1 Iron - Alpha
4.57507 0.88371 4.72148 100.00000 0.00000 643.9 0.375 1.86 1 1 Iron - Alpha
4.57507 0.88371 4.72148 120.00000 0.00000 680.4 0.375 1.75 1 1 Iron - Alpha
4.57507 0.88371 4.72148 140.00000 0.00000 691.6 0.375 1.81 1 1 Iron - Alpha
4.57507 0.88371 4.72148 160.00000 0.00000 674.9 0.375 1.66 1 1 Iron - Alpha
4.58254 0.87567 4.69293 180.00000 0.00000 651.6 0.286 1.95 1 1 Iron - Alpha
4.58254 0.87567 4.69293 200.00000 0.00000 657.5 0.286 1.92 1 1 Iron - Alpha
4.58254 0.87567 4.69293 220.00000 0.00000 693.4 0.286 2.18 1 1 Iron - Alpha
4.58254 0.87567 4.69293 240.00000 0.00000 670.5 0.286 2.06 1 1 Iron - Alpha
最初の 3 つの列は、使用しているテキスト ファイルからデータを抽出するためのオイラー角 phi1、phi、phi2 です。
fid = fopen('test.txt');
A = textscan(fid, '%f %f %f %f %f %*f %*f %*f %*f %*f %*s %*s %*s') ;
%read the file
a = A{1};
e = A{2};
c = A{3};
x = A{4};
y = A{5};
%converted the euler angles into degrees
phi1= radtodeg(a);
phi= radtodeg(e);
phi2= radtodeg(c);
ここで、phi1 は 1999999X1 の配列であり、同様に phi と phi2 は同じサイズの配列であり、これは後の部分で使用しています。