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

Translate the entire conversation x

Creating matrix/table from the results of a function

CN_13593194
8-Gravel

Creating matrix/table from the results of a function

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

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:CN_13593194)



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

 

 

 

View solution in original post

5 REPLIES 5
LucMeekes
23-Emerald IV
(To:CN_13593194)

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

done! thank you

Thank you, a couple follow up questions

 

how do you define/type M r,c? I tried doing M (ctrl -) c (then I try to type a comma, and it goes out of the subscript, so there is a trick there that I am missing)

CN_13593194_2-1748888708603.png

 

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

CN_13593194_0-1748888671062.png

none of these seem to be what you did there

Werner_E
25-Diamond I
(To:CN_13593194)



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

 

 

 

image.png

Announcements


Top Tags