3.2

3.2 | 5 ratings Rate this file 138 downloads (last 30 days) File Size: 3 KB File ID: #6335

Euler angles to Quaternion Conversion (for six basic sequence of rotations)

by Dr. Murtaza Khan

 

18 Nov 2004 (Updated 17 Jul 2009)

Code covered by BSD License  

Allowed rotations sequences: xyz, xzy, yxz, yzx, zxy, zyx

Download Now | Watch this File

File Information
Description

Euler Angles To Quaternion Conversion for six basic sequence of rotations around X(Roll),Y(Pitch) and Z(Yaw) axis.

Allowed Sequences: xyz, xzy, yxz, yzx, zxy, zyx.

MATLAB release MATLAB 7.0.1 (R14SP1)
Zip File Content  
Other Files eulertoquat/euler2quat.m,
eulertoquat/quaternionmul.m,
eulertoquat/testeuler2quat.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
10 Oct 2005 M Khan

A GUI based sharware can be check at
http://mak2000.sky.prohosting.com/eulerquatpro.html

28 Oct 2005 John Da Graca  
24 May 2006 Avetis Ioannisyan

no source code?

13 Apr 2007 Dave Grymin

Very straight-forward, easy to use.

15 Jul 2009 James Tursa

This submission has the following problems:

1) The code only covers six of the twelve possible triple rotation sequences. It leaves out the xyx, xzx, yxy, yzy, zxz, and zyz sequences.

2) Typing 'help eulertoquat' doesn't give you much of anything useful. Only a brief description of the function is given. All of the critical necessary information that should be in the help (quaternion convention (is scalar first or last?, etc), what units are acceptable for the euler angles, what order are the arguments, etc, etc) are not displayed. You have to manually edit the file eulertoquat.m to discover all of this.

3) The supplied testeuler2quat.m file doesn't work at all. First, it clears your command window, closes everything, and clears your workspace (very bad). Then it exits with an error because the function it calls, namely euler2quat, does not match the actual function name in the submission, eulertoquat. After changing the testeuler2quat.m file so that it called eulertoquat, it bombed again. This time because the number of output arguments did not match up. So after fixing that up, it bombed *again*. This time because the quaternion multiply routine func_QuatMult was missing ... it did not match the supplied function quaternionmul.m. So after fixing *that* up the test routine finally ran, but the results are pretty much useless as a test. Other than checking to see that the norm of the result is 1, nothing is supplied to check the correctness of the result.

4) There is no inverse function supplied. For example, a quattoeuler.m function would be appropriate. That would at least allow the user to check the results for consistency.

5) The code is not written as efficiently as it could. e.g., the current code creates several temorary variables, does the multiply into more temorary variables, and then gathers up the temorary variables and concatenates them into a single result to return. But by simply preallocating the quaternion result and then putting the calculation results directly into the return variable I was able to save about 5% off the running time.

6) The code is not vectorized! That is, you cannot input a vector or matrix of inputs and get a vector or matrix of outputs. You would have to call this function in a loop to get the results for a vector or matrix of inputs.

7) I don't usually question other people's ratings, but in this case I must. How can this submission possibly get 4 and 5 stars from others when it doesn't even run out of the box? "... easy to use ..." ??? What is going on here?

I spot checked a couple of cases against other code I have (see below), and I did check the formula used for the quaternion multiply, and it appears to be correct. But if you want to see a *much* better submission for converting between quaternions, direction cosine matrices, and euler angle sequences that *is* vectorized and *does* have a useful help, I highly advise that you download this other submission by John Fuller:

http://www.mathworks.com/matlabcentral/fileexchange/20696

James Tursa

Please login to add a comment or rating.
Updates
19 Sep 2005

upgraded

09 Jul 2009

BSD License

17 Jul 2009

missing file is added

Tag Activity for this File
Tag Applied By Date/Time
aerospace Dr. Murtaza Khan 22 Oct 2008 07:36:02
aeronautics Dr. Murtaza Khan 22 Oct 2008 07:36:02
aerodef Dr. Murtaza Khan 22 Oct 2008 07:36:02
euler angles Dr. Murtaza Khan 22 Oct 2008 07:36:02
pitch Dr. Murtaza Khan 22 Oct 2008 07:36:02
roll Dr. Murtaza Khan 22 Oct 2008 07:36:02
quaternion conversion Dr. Murtaza Khan 22 Oct 2008 07:36:02
yaw Dr. Murtaza Khan 22 Oct 2008 07:36:03
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com