Conversion between Euler angles and rotation matrix --- Matlab code
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 |
From: Hiho <haifeng.g...@gmail.com>
Date: Thu, 10 Apr 2008 20:37:07 -0700 (PDT)
Local: Thurs, Apr 10 2008 11:37 pm
Subject: Conversion between Euler angles and rotation matrix --- Matlab code
function orthm = ang2orth(ang)
sa = sin(ang(2)); ca = cos(ang(2));
sb = sin(ang(1)); cb = cos(ang(1));
sc = sin(ang(3)); cc = cos(ang(3));
ra = [ ca, sa, 0; ...
-sa, ca, 0; ...
0, 0, 1];
rb = [ cb, 0, sb; ...
0, 1, 0; ...
-sb, 0, cb];
rc = [ 1, 0, 0; ...
0, cc, sc;...
0, -sc, cc];
orthm = rc*rb*ra;
function ang = orth2ang(orthm)
ang(1) = asin(orthm(1,3)); %Wei du
ang(2) = angle( orthm(1,1:2)*[1 ;i] ); %Jing Du
yz = orthm* ...
[orthm(1,:)',...
[-sin(ang(2)); cos(ang(2)); 0],...
[-sin(ang(1))*cos(ang(2)); -sin(ang(1)*sin(ang(2)));
cos(ang(1))] ];
ang(3) = angle(yz(2,2:3)* [1; i]); % Xuan Du
You must Sign in before you can post messages.
You do not have the permission required to post.
|
 |
From: "Sha Ma" <masha....@gmail.com>
Date: Fri, 11 Apr 2008 13:16:24 +0800
Local: Fri, Apr 11 2008 1:16 am
Subject: Re: Conversion between Euler angles and rotation matrix --- Matlab code
hehe,thank you very much!!! ^_^ 2008/4/11, Hiho <haifeng.g...@gmail.com>:
> function orthm = ang2orth(ang) > sa = sin(ang(2)); ca = cos(ang(2)); > sb = sin(ang(1)); cb = cos(ang(1)); > sc = sin(ang(3)); cc = cos(ang(3)); > ra = [ ca, sa, 0; ... > -sa, ca, 0; ... > 0, 0, 1]; > rb = [ cb, 0, sb; ... > 0, 1, 0; ... > -sb, 0, cb]; > rc = [ 1, 0, 0; ... > 0, cc, sc;... > 0, -sc, cc]; > orthm = rc*rb*ra; > function ang = orth2ang(orthm) > ang(1) = asin(orthm(1,3)); %Wei du > ang(2) = angle( orthm(1,1:2)*[1 ;i] ); %Jing Du > yz = orthm* ... > [orthm(1,:)',... > [-sin(ang(2)); cos(ang(2)); 0],... > [-sin(ang(1))*cos(ang(2)); -sin(ang(1)*sin(ang(2))); > cos(ang(1))] ]; > ang(3) = angle(yz(2,2:3)* [1; i]); % Xuan Du
You must Sign in before you can post messages.
You do not have the permission required to post.
|
 |
From: "Haifeng Gong" <haifeng.g...@gmail.com>
Date: Fri, 11 Apr 2008 10:20:15 -0700
Local: Fri, Apr 11 2008 1:20 pm
Subject: Re: Conversion between Euler angles and rotation matrix --- Matlab code
hehe I use this Google Group to preserve my reusable code. Haifeng
On Thu, Apr 10, 2008 at 10:16 PM, Sha Ma <masha. ...@gmail.com> wrote: > hehe,thank you very much!!! ^_^ > 2008/4/11, Hiho <haifeng.g...@gmail.com>: > > function orthm = ang2orth(ang) > > sa = sin(ang(2)); ca = cos(ang(2)); > > sb = sin(ang(1)); cb = cos(ang(1)); > > sc = sin(ang(3)); cc = cos(ang(3)); > > ra = [ ca, sa, 0; ... > > -sa, ca, 0; ... > > 0, 0, 1]; > > rb = [ cb, 0, sb; ... > > 0, 1, 0; ... > > -sb, 0, cb]; > > rc = [ 1, 0, 0; ... > > 0, cc, sc;... > > 0, -sc, cc]; > > orthm = rc*rb*ra; > > function ang = orth2ang(orthm) > > ang(1) = asin(orthm(1,3)); %Wei du > > ang(2) = angle( orthm(1,1:2)*[1 ;i] ); %Jing Du > > yz = orthm* ... > > [orthm(1,:)',... > > [-sin(ang(2)); cos(ang(2)); 0],... > > [-sin(ang(1))*cos(ang(2)); -sin(ang(1)*sin(ang(2))); > > cos(ang(1))] ]; > > ang(3) = angle(yz(2,2:3)* [1; i]); % Xuan Du
-- Haifeng GONG Post-doctoral Scholar Department of Statistics, UCLA
You must Sign in before you can post messages.
You do not have the permission required to post.
|
|
|