Rank: 785 based on 147 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
24 Jul 2013 Screenshot Defining Cartesian Reference Frames based on Point Positions Defining 3-D Cartesian reference frames based on the positions of at least 3 non-collinear points Author: Paolo de Leva mechanical modeling, cartesian coordinate ..., reference frame, orientation matrix, arraylab, biomechanics 22 1
  • 5.0
5.0 | 3 ratings
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 21 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 linear algebra, matrix, vector, scalar, product, multiplication 53 39
  • 4.95
5.0 | 42 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, outer product, cross division, norm, unit vector, linear 33 9
  • 5.0
5.0 | 6 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 18 1
  • 5.0
5.0 | 1 rating
Comments and Ratings by Paolo View all
Updated File Comments Rating
22 May 2013 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

Dear Xiaodong, thank you for your offer, but I cannot include your function DOT3 in my package. The dot product requires the complex conjugate of its first operand to deal with complex vectors. Even the MATLAB function DOT applies it:

C = SUM(CONJ(A).*B, DIM)

Notice that, for real arrays,

CONJ(A) = A

hence, your function DOT3 will give correct results only when operating on real vectors, while DOT2, included in my package, is supposed to give correct results for both real and complex vectors.

Moreover, your function does nothing else than calling MULTIPROD. It would be more convenient to call it directly, using syntax 4b:

C = MULTIPROD(A, B, DA1, DB2)

For instance, if vectors are contained along dimension 2 of A and B, and you do not want to compute the conj(A), you can use

C = MULTIPROD(A, B, 2, 2)

or more simply

C = MULTIPROD(A, B, 2).

22 May 2013 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

There's a typo at the end of my previous comment. I should have written:

...if vectors are contained along dimension 2 of A and B, you can use

C = MULTIPROD(A, B, 2, 2)

or more simply

C = MULTIPROD(A, B, 2).

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

Comments and Ratings on Paolo's Files View all
Updated File Comment by Comments Rating
01 Aug 2014 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 Katliar, Mikhail

Very helpful, exactly what I needed.

23 Jul 2014 Binary array expansion function element-by-element binary operations (e.g. plus, times, eq, gt) with array expansion (AX) enabled. Author: Paolo de Leva Herbster, Adolfo

23 Jul 2014 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 Herbster, Adolfo

29 Jun 2014 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 Diaz, Manuel

27 May 2014 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 Anikiev, Denis

Contact us