Skip to main content
10-Marble
June 2, 2025
Solved

Creating matrix/table from the results of a function

  • June 2, 2025
  • 1 reply
  • 815 views

Beginner here. I followed this topic: Solved: Using results from output of function - PTC Community

however, that example generates a vector

I am trying to do it for a matrix, and I get instead a long vector:

CN_13593194_0-1748881841256.png

How can I make it so that the values of alfa/phi changes in the rows/columns returning all the results from the equation of P. 

 

edit: attached a file and using mathcad prime 9.0.0.0

Best answer by Werner_E


I also tried typing M and then press "[" but that creates a little bracket below M:

And thats exactly whats needed! To create a matrix you have to use matrix indices. The small bracket or rectangle is only visible as long as the cursor is within the region.

BTW, in your attempt you are NOT seeing a 289x1 vector even though it looks that way. What you see is kind of an invalid object which just looks like a vector. You can tell so if you try to assign it a variable for later use. XYZ := P(alpha, phi) will throw a strange error message ("this value must be a scalar"). Werner_E_0-1748891911609.pngReason is that alpha and phi are defined as ranges - they look like vectors, but aren't.

 

As you are looking for a 17 x 17 result matrix and you left ORIGIN at its default value zero, you first define as Luc had shown two ranges r and c running from 0 to 16. Based on these ranges you have to calculate the desired alpha and phi values and feed them into the function P.

alpha = 0.1 + 0,05*r   and   phi = 5° + 5° * c.

Using r and c as matrix indices you thus create the desired matrix:

Werner_E_1-1748891987072.png

I have chosen unit MN for a clearer display.

 

You may also add row- and column-headers:

Werner_E_2-1748892063655.png

But Prime does not allow to change the unit N to MN for the matrix elements.

So sometimes its more appropriate to get rid of the unit altogether and add a legend telling the reader that the values are to be read as values in MN.

Werner_E_3-1748892358068.png

 

Prime 9 sheet attached

 

 

 

1 reply

23-Emerald IV
June 2, 2025

Please attach your Prime worksheet file (the .mcdx file), and state which version of Prime you are using.

Other than that, the magic goes like this:

LucMeekes_0-1748886466620.png

 

Success!
Luc

netoprax10-MarbleAuthor
10-Marble
June 2, 2025

done! thank you