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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

4-Participant

## exporting the vector of f(x,y) function into matrix or table.

Hi guys,

I have to export data for 3d plotting in excel.

what I have is a function f(x,y) which gives me the results in vector form of course.

anybody know how I can convert the vector into a matrix or export it to an excel sheet.

Best

ALi

1 ACCEPTED SOLUTION

Accepted Solutions
23-Emerald III
(To:ptc-5892428)

You use ranges instead of vectors, and hence you don't get matrices and can't use the export functions.

Attached is a way it should work. (Prime 4)

Success!
Luc

12 REPLIES 12
10-Marble
(To:ptc-5892428)

Use WRITEEXCEL function, or Excel Component.

23-Emerald III
(To:MSheykman)
Note that the OP posted his question over three months ago...

Luc
23-Emerald I
(To:LucMeekes)

@LucMeekes wrote:
Note that the OP posted his question over three months ago...

Luc

Yeah!  Well:

• Bored,
• Looking for something to occupy my time. . .    😉
23-Emerald I
(To:ptc-5892428)

@ptc-5892428 wrote:

Hi guys,

I have to export data for 3d plotting in excel.

what I have is a function f(x,y) which gives me the results in vector form of course.

anybody know how I can convert the vector into a matrix or export it to an excel sheet.

Best

ALi

First of all, you don't really have a vector.

Because you define A and B as range variables, your formula computes; but if you try to define a vector (Vc), the program throws an error.  You can turn A and B into vectors (an undocumented and dangerous practice) by putting an "evaluation" equals sign after the definition; but the results aren't what you'd expect:

Why?  Because A and B are both vectors, so the multiplication signs in the equation are interpreted as "dot products," and you get a single value answer.  You can "vectorize" the equation (means evaluate for each set of values in each vector) and get:

But that's still not what you want.

I'm not sure how you would get a 3D plot in EXCEL; but in Mathcad you'd use the function "CreateMesh" to create a (very large) three column array (AKA matrix) that you'd then drop into a 3D plot.

Hope this helps!

4-Participant
(To:Fred_Kohlhepp)

Hi Fred,

thank you for the explanation. firstly, I have a format issue with Mathcad graphs, journals ask for graphs in vector form.

exporting to excel helps me to use other software.

Honestly, I tried hard to understand how your and the others answers could help me but apparently, I didn't ask the right question.

I have this formula and graph and everything is okay and I happy with the results.

help me export the data to excel to plot it by let say MATLAB.

thanx

23-Emerald III
(To:ptc-5892428)

You use ranges instead of vectors, and hence you don't get matrices and can't use the export functions.

Attached is a way it should work. (Prime 4)

Success!
Luc

4-Participant
(To:LucMeekes)

and that's what I wanted.

thank you Luc

23-Emerald III
(To:ptc-5892428)

You're welcome.

You could mark the question/topic as answered...

Luc

10-Marble
(To:ptc-5892428)

Could you please share how do you prepare your articles for journals?

It is possible to print / save a Mathcad Prime document to PDF or XPS file and 2D plots will be in vector format inside that PDF or XPS file, but 3D plots will be in raster format.

24-Ruby V
(To:ptc-5892428)

Excel does not support a decent surface plot as far as I know. The surface plot in Excel simply takes a  n x m matrix of z-values and shows a surface over an equidistant xy-grid. So all that would have to be done is create that kind of matrix at equidistant positions and export to Excel.

But as the thread is rather old and the questioner never came back to push the question its likely he is not interested anymore. Its surprising that nobody had answered that question months ago when it was fresh - maybe it was moved from a different (wrong) section to this forum just later and the thread did not bubble up because of the older date?

BTW, what we see in the sheet is a severe bug in Primes 3D plot!

The function arguments are mixed - the first, phi2, is a free, unassigned variable but the second, A, is  range from 0 to 5. So we would expect to see the x axis from -10 to 10 and the y-axis from 0 to 5. In first sight the opposite seems to be true but on second sight the catastrophe: Prime exchanged x- and y-axis!!!!

23-Emerald I
(To:Werner_E)

That axis reversal is OLD.

I pointed that out during a beta review (back when Mona was still here.)  Shows how much I use 3D plots!

24-Ruby V
(To:Fred_Kohlhepp)

@Fred_Kohlhepp wrote:

That axis reversal is OLD.

I pointed that out during a beta review (back when Mona was still here.)  Shows how much I use 3D plots!

I wasn't aware of that bug in Prime. Shows how much I use Prime, I guess (not at all, except to answer in this forum).

It seems to have to do with the new syntax which in Prime is additionally allowed. In real Mathcad you get an error if you enter the function name PLUS arguments in the 3D-plot placeholder - no matter whether  those arguments are defined as ranges or undefined variables.

Anyway - one more reason to control the output of a 3D plot only via CreateMesh - its more convenient and secure.

Announcements
Top Tags