码迷,mamicode.com
首页 > 其他好文 > 详细

MATLAB自定义函数Rodrigues

时间:2019-05-20 19:06:04      阅读:904      评论:0      收藏:0      [点我收藏+]

标签:col   matrix   str   div   span   func   mat   orm   pre   

The customized MATLAB function is to onvert a rotation vector to a rotation matrix.

function [rotation_matrix] = Rodrigues( rotation_vector )
%   Convert a rotation vector to a rotation matrix.
    rotation_vector = rotation_vector;
    theta = norm(rotation_vector);
    rotation_vector = rotation_vector./theta;
    I = eye(3);
    tmp_matrix = [0 -rotation_vector(3) rotation_vector(2); ...
        rotation_vector(3) 0 -rotation_vector(1); ...
        -rotation_vector(2) rotation_vector(1) 0];
    rotation_matrix = cos(theta) * I + (1 - cos(theta)) * ...
    (rotation_vector * rotation_vector) + sin(theta) * tmp_matrix;
end

 

MATLAB自定义函数Rodrigues

标签:col   matrix   str   div   span   func   mat   orm   pre   

原文地址:https://www.cnblogs.com/weiyu-blog/p/10895868.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!