Rank: 331 based on 196 downloads (last 30 days) and 3 files submitted
Personal Profile:

I'm an aerospace systems engineer in the Washington, D.C. region. I have a B.S. and an M.S. in Aerospace Engineering from NCSU, and I've been using Matlab in both work and school since 2004. I'm almost considering using it to do my taxes.

Professional Interests:
Aerospace, GN&C, trajectory analysis, orbit dynamics

 

Watch this Author's files

 

Files Posted by John View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
25 Jan 2013 Function to Convert between DCM, Euler angles, Quaternions, and Euler vectors Function to convert rotation data between 4 types: DCM, Euler Angles, Quaternions, and Euler Param. Author: John Fuller aerospace, rotation, 3d, direction cosines, euler angle, dcm 105 32
  • 4.58333
4.6 | 12 ratings
12 Sep 2012 Screenshot Euler angle, DCM, Quaternion, and Euler Vector Conversion/Teaching GUI A GUI that helps users learn how Euler angles and other rotational data relate to one another. Author: John Fuller euler angles, quaternion, dcm, euler, aerospace, gui 73 1
  • 4.0
4.0 | 2 ratings
01 Dec 2011 Screenshot Newton-Raphson Iterative Solver for Systems of Equations An N-R iterative root-finder for systems of N equations and N unknowns. Author: John Fuller newton, raphson, iterative, solver, systems of equations, root 18 2
  • 2.0
2.0 | 1 rating
Comments and Ratings by John View all
Updated File Comments Rating
22 Jan 2013 Function to Convert between DCM, Euler angles, Quaternions, and Euler vectors Function to convert rotation data between 4 types: DCM, Euler Angles, Quaternions, and Euler Param. Author: John Fuller

Paolo,
I have incorporated a fix to address that bug, which is largely similar to your snippet. Thanks for catching this!

28 Aug 2012 KML Toolbox v2.6 Create KML/KMZ files and view them in Google Earth. Supports 3D models, contours, overlays, and more Author: Rafael Oliveira

17 Aug 2012 KML Toolbox v2.6 Create KML/KMZ files and view them in Google Earth. Supports 3D models, contours, overlays, and more Author: Rafael Oliveira

Rafael,
I get the following error when I run the quiver function example snippet:

k = kml('my kml file');

% Create a sample quiver plot in the kml file
[x,y] = meshgrid(-5:.2:5,-2:.15:2);
z = x .* exp(-x.^2 - y.^2) + y.*sin(x);
[px,py] = gradient(z,.2,.15);
k.quiver(5*x,10*y,8*px,8*py)

% Save the kml and open it in Google Earth
k.save;
??? Undefined function or variable 'id'.

Error in ==> kml.quiver at 61
target(i) = f.plot(long2,lat2, 'altitude',arg.altitude,...

Any thoughts?

11 Apr 2012 Vectorized Analytic Two Body Propagator (Kepler Universal Variables) Analytic propagation routine uses universal variables to solve a single formula for all orbit types Author: Darin Koblick

Downloaded but can't seem to unzip. Not sure if the file is corrupted, may want to check.

20 Oct 2011 Newton-Raphson Iterative Solver for Systems of Equations An N-R iterative root-finder for systems of N equations and N unknowns. Author: John Fuller

No humor with this one :)

Comments and Ratings on John's Files View all
Updated File Comment by Comments Rating
29 Jan 2013 Function to Convert between DCM, Euler angles, Quaternions, and Euler vectors Function to convert rotation data between 4 types: DCM, Euler Angles, Quaternions, and Euler Param. Author: John Fuller de Leva, Paolo

That's bad. My second last posting was totally deleted by MATLAB Central, possibly because it contained special characters...

I wrote that in your latest release of SpinCalc, you introduced a new bug in line 238.

In that line (which I cannot copy here because it contains special characters), you should use the element-by-element OR operator (single vertical bar), rather than the short-circuit OR operator (double bar) which does not work when N is greater than 1.

In short, you should go back to previous version of line 238.

Please also check my 4 advices posted yesterday.

29 Jan 2013 Function to Convert between DCM, Euler angles, Quaternions, and Euler vectors Function to convert rotation data between 4 types: DCM, Euler Angles, Quaternions, and Euler Param. Author: John Fuller de Leva, Paolo

MATLAB Central keeps truncating everything I write after special characters. In my latest posting, the logical OR operators and whatever was written after them were deleted. Anyway, you can check previous version of line 238. You should use the element-by-element OR operator (single vertical bar), rather than the short-circuit OR operator (double bar).

28 Jan 2013 Function to Convert between DCM, Euler angles, Quaternions, and Euler vectors Function to convert rotation data between 4 types: DCM, Euler Angles, Quaternions, and Euler Param. Author: John Fuller de Leva, Paolo

I have been trying to post this text, but MATLAB Central keeps truncating it. Here is the complete version, with special characters removed:

1) Please update the release version number.

2) Line 388:

OUTPUT=mod([psi,theta,phi]*180/pi,360);

Proposed change:

OUTPUT=[psi,theta,phi]*180/pi;

THETA is computed in your code either using ACOS or ASIN. In MATLAB, both ACOS(X) and ASIN(X) return values within a limited range. For -1 =< X =< 1,

ACOS_X = ACOS(X)*(180/pi)

always returns values ranging from 0 to 180 degrees. This almost coincides with the range (from 0.1 to 179.9 degrees) accepted by SpinCalc as input for THETA (with EA type 2 rotations). Similarly, for -1 =< X =< 1,

ASIN_X = ASIN(X)*(180/pi)

always returns angles ranging from -90 to 90 degrees. Again, this almost coincides with the range (from -89.9 to 89.9 degrees) accepted by SpinCalc as input for THETA (with EA type 1 rotations). If X < -1 or X > 1, then the result ACOS_X or ASIN_X is complex, and SpinCalc returns an error message.
Computing MOD(ACOS_X,360) is useless, because

THETA = MOD(ACOS_X, 360) = ACOS_X

More importantly, computing MOD(ASIN_X,360) is inconsistent with other parts of your code, because for negative values of ASIN_X (i.e. -90 =< ASIN_X < 0 degrees)

THETA = MOD(ASIN_X, 360) == ASIN_X + 360

which means that, for negative values of ASIN_X, THETA will range from 270 =< ASIN_X < 360 degrees, which is considered to be out range when used as input for SpinCalc (with EA type 1 rotations).

3) Line 396:

sing_chk=...
[find(abs(theta*180/pi) < 0.1); ...
find(abs(theta*180/pi-180) < 0.1);...
find(abs(theta*180/pi-360)) < 0.1];

Proposed change:

sing_chk=...
[find(abs(theta*180/pi) < 0.1); ...
find(abs(theta*180/pi-180) < 0.1);...
find(abs(theta*180/pi-360) < 0.1)];

4) Every time you convert a Nx1 or Nx3 array containing angles in radians into an array containing angles in degrees, or vice versa (and you do it a lot of times in your code, including the above mentioned lines 388 and 396), you use this syntax:

Y = X*180/pi
or
Y = X*pi/180

This way, you repeat the division (by PI or by 180) N times. I suggest you to use this sintax, which is much more efficient as it computes the division only once (see also functions deg2rad and rad2deg):

Y = X*(180/pi)
or
Y = X*(pi/180).

28 Jan 2013 Function to Convert between DCM, Euler angles, Quaternions, and Euler vectors Function to convert rotation data between 4 types: DCM, Euler Angles, Quaternions, and Euler Param. Author: John Fuller de Leva, Paolo

I am trying to post this text, containing a few notes about SpinCalc, but the web site keeps truncating it. Here is the complete version, with a few special characters removed:

1) Please update the release version number.

2) Line 388:

OUTPUT=mod([psi,theta,phi]*180/pi,360);

Proposed change:

OUTPUT=[psi,theta,phi]*180/pi;

THETA is computed in your code either using ACOS or ASIN. In MATLAB, both ACOS(X) and ASIN(X) return values within a limited range. For -1 <= X <= 1,

ACOS_X = ACOS(X)*(180/pi)

always returns values ranging from 0 to 180 degrees. This almost coincides with the range (from 0.1 to 179.9 degrees) accepted by SpinCalc as input for THETA (with "input type" EA### and "Euler type" 2). Similarly, for -1 <= X <= 1,

ASIN_X = ASIN(X)*(180/pi)

always returns angles ranging from -90 to 90 degrees. Again, this almost coincides with the range (from -89.9 to 89.9 degrees) accepted by SpinCalc as input for THETA (with "input type" EA### and "Euler type" 1). If X > 1 or X < -1, then the result ACOS_X or ASIN_X is complex, and SpinCalc returns an error message.
Computing MOD(ACOS_X,360) is useless, because

THETA = MOD(ACOS_X, 360) = ACOS_X

More importantly, computing MOD(ASIN_X,360) is inconsistent with other parts of your code, because for negative values of ASIN_X (i.e. -90 <= ASIN_X < 0 degrees)

THETA = MOD(ASIN_X, 360) == ASIN_X + 360

which means that, for negative values of ASIN_X, THETA will range from 270 <= ASIN_X < 360 degrees, which is considered to be out range when used as input for SpinCalc (with "input type" EA### and "Euler type" 1).

3) Line 396:

sing_chk=...
[find(abs(theta*180/pi) < 0.1); ...
find(abs(theta*180/pi-180) < 0.1);...
find(abs(theta*180/pi-360)) < 0.1];

Proposed change:

sing_chk=...
[find(abs(theta*180/pi) < 0.1); ...
find(abs(theta*180/pi-180) < 0.1);...
find(abs(theta*180/pi-360) < 0.1)];

4) Every time you convert a Nx1 or Nx3 array containing angles in radians into an array containing angles in degrees, or vice versa (and you do it a lot of times in your code, including the above mentioned lines 388 and 396), you use this syntax:

Y = X*180/pi
or
Y = X*pi/180

This way, you repeat the division (by PI or by 180) N times. I suggest you to use this sintax, which is much more efficient as it computes the division only once (see also functions deg2rad and rad2deg):

Y = X*(180/pi)
or
Y = X*(pi/180).

28 Jan 2013 Function to Convert between DCM, Euler angles, Quaternions, and Euler vectors Function to convert rotation data between 4 types: DCM, Euler Angles, Quaternions, and Euler Param. Author: John Fuller de Leva, Paolo

I am trying to post this text, containing a few notes about SpinCalc, but the web site keeps truncating it. Here is the complete version, with a few special characters removed:

1) Please update the release version number.

2) Line 388:

OUTPUT=mod([psi,theta,phi]*180/pi,360);

Proposed change:

OUTPUT=[psi,theta,phi]*180/pi;

THETA is computed in your code either using ACOS or ASIN. In MATLAB, both ACOS(X) and ASIN(X) return values within a limited range. For -1<=X<=1,

ACOS_X = ACOS(X)*(180/pi)

always returns values ranging from 0 to 180 degrees. This almost coincides with the range (from 0.1 to 179.9 degrees) accepted by SpinCalc as input for THETA (with "input type" EA### and "Euler type" 2). Similarly, for -1<=X<=1,

ASIN_X = ASIN(X)*(180/pi)

always returns angles ranging from -90 to 90 degrees. Again, this almost coincides with the range (from -89.9 to 89.9 degrees) accepted by SpinCalc as input for THETA (with "input type" EA### and "Euler type" 1). If X>1 or X<-1, then the result ACOS_X or ASIN_X is complex, and SpinCalc returns an error message.
Computing MOD(ACOS_X,360) is useless, because

THETA = MOD(ACOS_X, 360) = ACOS_X

More importantly, computing MOD(ASIN_X,360) is inconsistent with other parts of your code, because for negative values of ASIN_X (i.e. -90<=ASIN_X<0 degrees)

THETA = MOD(ASIN_X, 360) == ASIN_X + 360

which means that, for negative values of ASIN_X, THETA will range from 270<=ASIN_X<360 degrees, which is considered to be out range when used as input for SpinCalc (with "input type" EA### and "Euler type" 1).

3) Line 396:

sing_chk=...
[find(abs(theta*180/pi)<0.1); ...
find(abs(theta*180/pi-180)<0.1);...
find(abs(theta*180/pi-360))<0.1];

Proposed change:

sing_chk=...
[find(abs(theta*180/pi)<0.1); ...
find(abs(theta*180/pi-180)<0.1);...
find(abs(theta*180/pi-360)<0.1)];

4) Every time you convert a Nx1 or Nx3 array containing angles in radians into an array containing angles in degrees, or vice versa (and you do it a lot of times in your code, including the above mentioned lines 388 and 396), you use this syntax:

Y = X*180/pi
or
Y = X*pi/180

This way, you repeat the division (by pi or by 180) N times. I suggest you to use this sintax, which is much more efficient as it computes the division only once:

Y = X*(180/pi)
or
Y = X*(pi/180).

Top Tags Applied by John
aerospace, dcm, quaternion, rotation, 3d
Files Tagged by John View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
25 Jan 2013 Function to Convert between DCM, Euler angles, Quaternions, and Euler vectors Function to convert rotation data between 4 types: DCM, Euler Angles, Quaternions, and Euler Param. Author: John Fuller aerospace, rotation, 3d, direction cosines, euler angle, dcm 105 32
  • 4.58333
4.6 | 12 ratings
12 Sep 2012 Screenshot Euler angle, DCM, Quaternion, and Euler Vector Conversion/Teaching GUI A GUI that helps users learn how Euler angles and other rotational data relate to one another. Author: John Fuller euler angles, quaternion, dcm, euler, aerospace, gui 73 1
  • 4.0
4.0 | 2 ratings
01 Dec 2011 Screenshot Newton-Raphson Iterative Solver for Systems of Equations An N-R iterative root-finder for systems of N equations and N unknowns. Author: John Fuller newton, raphson, iterative, solver, systems of equations, root 18 2
  • 2.0
2.0 | 1 rating

Contact us