Cross product magnitude computation
5 次查看(过去 30 天)
显示 更早的评论
Hi,
Trying to get the elements for a RSW reference frame (orbital mechanics concept), I have problems regarding to the magnitude of one cross product between 2 vectors, the results are very innacurate and after searching on internet I got the conclusion that the problem is on the way that I'm trying to compute the cross product magnitude. My code section is as follows:
Please, could you help me to have a better idea of this cross product magnitude?
SZp = [SZ1; SZ2; SZ3]; % Position difference % 3x262 double
SZv = [SZ4; SZ5; SZ6]; % Velocity difference % 3x262 double
% Axes of the RSW system
er = R_p./sqrt((Sen1).^2 + (Sen2).^2 + (Sen3).^2); % | eR = r/|r| % Sen1,2,3 1x262 double, | | eR, eW, eS 3x262 double
rxv = cross(R_p,V_vel); % r x v % 3x262 double
mrxv = sqrt((rxv(1,:)).^2 + (rxv(2,:)).^2 + (rxv(3,:)).^2); % |r x v| !!! TRYING TO COMPUTE CROSS PRODUCT MAGNITUDE
ew = rxv./mrxv; % r x v / |r x v| ALSO THE PROBLEM COULD BE AT THIS STEP, eW is getting strange results despite eR and eS
es = cross(ew,er); % ew x er
% Projection of the difference on each vector, basis vector
R = dot(SZp,er);
S = dot(SZp,es);
W = dot(SZp,ew);
0 个评论
回答(1 个)
Gaurav Garg
2021-1-27
Hi Hugo,
The cross-product between two 3xm matrices (C = cross(A,B)) is calculated as follows -
1.) For the third row of resultant matrix C, element-wise product of second row of A and first row of B is subtracted from element-wise product of first row of A and second row of B
2.) For the first row of resultant matrix C, element-wise product of third row of A and second row of B is subtracted from element-wise product of second row of A and third row of B
3.) For the second row of resultant matrix C, element-wise product of first row of A and third row of B is subtracted from element-wise product of third row of A and first row of B
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!