Rank: 1011 based on 90 downloads (last 30 days) and 5 files submitted
photo

Paolo de Leva

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by Paolo View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
01 May 2013 SpinConv Conversion from a rotation representation type to another Author: Paolo de Leva aerospace, image processing, mathematics, rotation, euler angles, euler vector 4 0
26 Jul 2010 Screenshot Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva arraylab, singleton expansion, vector, scalar, product, multiplication 52 38
  • 4.94444
4.9 | 38 ratings
26 Feb 2009 Screenshot Vector algebra for arrays of any size, with array expansion enabled Multiple dot, cross, and outer products, cross divisions, norms, normalizations, projections, etc. Author: Paolo de Leva linear algebra, projection, algebra, singleton expansion, unit vector, linear 23 6
  • 5.0
5.0 | 5 ratings
23 Feb 2009 Binary array expansion function element-by-element binary operations (e.g. plus, times, eq, gt) with array expansion (AX) enabled. Author: Paolo de Leva array expansion, bsxfun, array, arraylab, expansion, matrix expansion 5 1
11 Dec 2006 Screenshot Defining Cartesian Reference Frames based on Point Positions Versatile algorithm defining Cartesian reference frames based on the positions of at least 3 points Author: Paolo de Leva mechanical modeling, cartesian coordinate ..., reference frame, orientation matrix, arraylab, biomechanics 6 1
  • 5.0
5.0 | 3 ratings
Comments and Ratings by Paolo View all
Updated File 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

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

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

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

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

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).

Comments and Ratings on Paolo's Files View all
Updated File Comment by Comments Rating
14 Mar 2013 Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva W, Romain

Hi Paolo,
I was wondering if it is possible without using a for-loop to multiply each row of a matrix by another matrix using multiprod in a vectorised way.

In my case: A [55000,3] and B [55000,3] and I want each row A [1,3] * B'[3,55000]? And I want something like:
t=1:55000
multiprod(A(t,:),B)

Very good job for this function! Cheers

18 Feb 2013 Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva Rajab

Hi Sir

It is really a great function.
Thanks for sharing.
Regards

14 Nov 2012 Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva Woodford, Oliver

Very useful in general, but there is an overhead which becomes significant when applying this function to smaller arrays.

31 Oct 2012 Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva YIXIAO

28 May 2012 Vector algebra for arrays of any size, with array expansion enabled Multiple dot, cross, and outer products, cross divisions, norms, normalizations, projections, etc. Author: Paolo de Leva Flynn, Mark

Paolo's Vector Algebra lab was the solution I have been looking for. This should be a part of the standard Matlab distribution because it realizes the full potential of what Matlab was meant to do.

Top Tags Applied by Paolo
array, multidimensional array, array expansion, arraylab, expansion
Files Tagged by Paolo View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
01 May 2013 SpinConv Conversion from a rotation representation type to another Author: Paolo de Leva aerospace, image processing, mathematics, rotation, euler angles, euler vector 4 0
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 153 32
  • 4.58333
4.6 | 12 ratings
26 Jul 2010 Screenshot Multiple matrix multiplications, with array expansion enabled Multiplying matrices, vectors, or scalars contained in two N-D arrays, with array expansion enabled. Author: Paolo de Leva arraylab, singleton expansion, vector, scalar, product, multiplication 52 38
  • 4.94444
4.9 | 38 ratings
16 May 2010 TIMEIT Benchmarking Function TIMEIT.M measures the time required to call a user-specified function Author: Steve Eddins time benchmark, timeit, potw, utilities, execution time, pick of the week 60 9
  • 5.0
5.0 | 7 ratings
26 Feb 2009 Screenshot Vector algebra for arrays of any size, with array expansion enabled Multiple dot, cross, and outer products, cross divisions, norms, normalizations, projections, etc. Author: Paolo de Leva linear algebra, projection, algebra, singleton expansion, unit vector, linear 23 6
  • 5.0
5.0 | 5 ratings

Contact us