Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Re: Maximum value for each m,n across X arrays/mat...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2014
12:37 PM

10-03-2014
12:37 PM

Hi all,

I am working on expanding the functionality of an old program to be able to perform an vector of cases for an already established vector. I have worked out all of the issues within the program to calculate each reasulting array/matrix. Now I want to compare results across the matrices using the max function. Previously I had used the augment function to combine vectors, but that isn't keeping the m,n combinations needed to be compared across the matrices at each m,n. Basically, I have x number of 11 x 7 matrices that I want the maximum value for each m,n combination reported in a resulting 11 x 7 matrix.

I have inserted the image below the shows what I have described above. I want the maximum value for each m,n in this matrix for the X number of nested matrices. This example just shows 2 matrices are nested.

I would greatly appreciate the help of the community. I searched previous postings and it seems that you can't do a calculation, such as max in this situation, so I would appreciate an alternative approach.

THANKS and have a great day!!!

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2014
01:10 PM

10-03-2014
01:10 PM

Try defining a new function max2 (a):=max (a) and then vectorised that over your matrix. Unfortunately, I'm Mathcadless at the moment so can't try it. If that doesn't work then it should be straightforward to write a brief program that will iterate over each element. Eg, If your array is called A

for i € 0 .. rows(A)

for j €0..cols (A)

M _{i, j} <- max (A _{i, j})

M

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2014
01:10 PM

10-03-2014
01:10 PM

Try defining a new function max2 (a):=max (a) and then vectorised that over your matrix. Unfortunately, I'm Mathcadless at the moment so can't try it. If that doesn't work then it should be straightforward to write a brief program that will iterate over each element. Eg, If your array is called A

for i € 0 .. rows(A)

for j €0..cols (A)

M _{i, j} <- max (A _{i, j})

M

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2014
01:13 PM

10-03-2014
01:13 PM

Re: Maximum value for each m,n across X arrays/matrices

Thank you Stuart for the quick reply - I will give those a try and revert with how it goes.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2014
01:14 PM

10-03-2014
01:14 PM

Re: Maximum value for each m,n across X arrays/matrices

Sorry! No idea what you wnat to achieve.

What I see is ONE 11x7 matrix consisting of 1x2 matrices.

What is m,n?

What is x number?

What is X number?

What should the result look like and what should it represent (in math terms).

As I understand you are looking for a number of maxima values - maxima of what?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-03-2014
01:27 PM

10-03-2014
01:27 PM

Re: Maximum value for each m,n across X arrays/matrices

Elegant and simple solution Stuart, THANKS!!! The **first** one worked with creating a new function. I am not well versed in working with nested matrices and this fits the bill.

THANKS and have a great day!!!

P.S. Sorry W.E. I wasn't clear enough. m,n are the rows and columns of the matrix. For each row,column in the matrix I have many values in nested arrays, which I noted as X arrays, and for which I want returned a single maximum value. The example in the image just shows two nested arrays.