cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

rotating co-ordinate system with multiple vector and through range of angles?

JBlackhole
16-Pearl

rotating co-ordinate system with multiple vector and through range of angles?

To all

I am looking for the mathcad syntax to carry out the rotation of multiple vectors through a range of angle (from 0deg to 90 deg).

I have a number of vectors containing 3 values (Nx,Ny,Nz) given in a reference co-ordinate system (fixed) (subscript ac)

A local co-ordinate system (subscript ‘) is defined

I am attempting to write the operation of rotating the local co-ordinate by angle theta (around Xac axis) to get the new vector values (in the
local co-ordinate) - for each vector and through the whole range of angle.

I am struggling a bit with the syntax required and any help would be appreciated. Attached a mcad sheet

Thanks in advance

Regards

JXB

ACCEPTED SOLUTION

Accepted Solutions
StuartBruff
23-Emerald III
(To:JBlackhole)

J B wrote:

Add a look at the info provided and I think it starting to make sense. I slightly reviewed the approach but I am stuck at extracting the data from the nested arrays

The approach is

step 1 . rotate global vectors (17 of them) into the local co-ordinate

step 2: rotate each vector through a range of angle (around x axis). (Which lead to the nested arrays)


I think I can extract the data for a given angle but ultimately I'd like to be able to extract the max values across all the cases and all the angles.

I think I may need to have a look at a matrix N x M = (91*17) x 3 = (nb of angle *nb of cases) x 3 set of values. see attached picture

Any ideas?

Thanks

Regards

JXB

I have had no time to do anything more than glance at your worksheet, but I think one of my general purpose functions (flatten) should do what you want

There are other ways of doing it, but I don't have time to make it any shorter or simpler!

Stuart

View solution in original post

7 REPLIES 7
StuartBruff
23-Emerald III
(To:JBlackhole)

I've only had a chance to skim the beginning (work is somewhat getting in the way!), but a few simple points:

Mathcad indices run, by default, from 0 not 1, so the highest row number is rows(array)-1 and not (rows(array)).

If you use range variables in an assignment, they must appear on both sides of the := or global equals operators.

You can't have units in an array index.

You can use Mathcad's matrix functionality to apply R(theta) to the whole of LFvec rather than deal with it a row at a time.

Stuart

Thanks StuartB for the pointers. Much appreciated. Not sure I fully understand the indexing but will start looking into it.

Add a look at the info provided and I think it starting to make sense. I slightly reviewed the approach but I am stuck at extracting the data from the nested arrays

The approach is

step 1 . rotate global vectors (17 of them) into the local co-ordinate

step 2: rotate each vector through a range of angle (around x axis). (Which lead to the nested arrays)


I think I can extract the data for a given angle but ultimately I'd like to be able to extract the max values across all the cases and all the angles.

I think I may need to have a look at a matrix N x M = (91*17) x 3 = (nb of angle *nb of cases) x 3 set of values. see attached picture

Any ideas?

Thanks

Regards

JXB

StuartBruff
23-Emerald III
(To:JBlackhole)

J B wrote:

Add a look at the info provided and I think it starting to make sense. I slightly reviewed the approach but I am stuck at extracting the data from the nested arrays

The approach is

step 1 . rotate global vectors (17 of them) into the local co-ordinate

step 2: rotate each vector through a range of angle (around x axis). (Which lead to the nested arrays)


I think I can extract the data for a given angle but ultimately I'd like to be able to extract the max values across all the cases and all the angles.

I think I may need to have a look at a matrix N x M = (91*17) x 3 = (nb of angle *nb of cases) x 3 set of values. see attached picture

Any ideas?

Thanks

Regards

JXB

I have had no time to do anything more than glance at your worksheet, but I think one of my general purpose functions (flatten) should do what you want

There are other ways of doing it, but I don't have time to make it any shorter or simpler!

Stuart

StuartBruff
23-Emerald III
(To:StuartBruff)

StuartBruff wrote:

J B wrote:

Add a look at the info provided and I think it starting to make sense. I slightly reviewed the approach but I am stuck at extracting the data from the nested arrays


I think I can extract the data for a given angle but ultimately I'd like to be able to extract the max values across all the cases and all the angles.

I have had no time to do anything more than glance at your worksheet, but I think one of my general purpose functions (flatten) should do what you want

There are other ways of doing it, but I don't have time to make it any shorter or simpler!

I had further look at it last night, and have presented a slightly more general and self-contained version of flatten.  Unfortunately my home laptop wouldn't open the data component (no Excel on laptop?), so I had to make some data up.

Getting back to your problem, what 'max values' are you after (eg, X, Y, Z ... )? Are you constrained to the values given in the table or are you looking for a more general solution?

Stuart

Thanks Stuart. Much appreciated. There should be an mcad function to "flatten" nested array!

StuartBruff
23-Emerald III
(To:JBlackhole)

J B wrote:

Thanks Stuart. Much appreciated.

No worries.

There should be an mcad function to "flatten" nested array!

Indeed.  In fact, there should at the least be a proper indexing method for accessing elements of nested arrays (eg, N1,2,3 and Nidx, where idx is a vector, and a set of Mathcad funtions to apply functions to nested arrays as a whole proper, plus default interpretations of standard operators (eg, element-by-element addition/subtraction/multiplication/division, etc.

Ideally, Mathcad should implement a proper Multi-Dimensional Array (MDA) system that hides the details of implementation from the user and provides high level operators and functions for creating, amending and joining MDAs.  Don't get me started on this subject .. I've got to keep my blood pressure under control!

One of the things you will find is there is a Very Long List Of Useful Features containing things that users have actually asked for and that both Mathsoft (Mathcad's original creator) and PTC both deem of much lower priority than fixing things that didn't really need fixing or took at least half-a-dozen steps backwards (ask any of the Old Hands about the static typing introduced in Mathcad 12 that messed up no end of Proper Worksheets written in Mathcad 11 (at least Prime has fixed that particular issue!) or the lack of essential features in Prime 3.1 that were in almost every version of Mathcad > M11.   I understand there is a migration plan to put much of the missing features back into Prime, but it looks like a long journey.

Stuart

Announcements

Top Tags