Skip to main content
1-Visitor
September 1, 2018
Solved

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

  • September 1, 2018
  • 3 replies
  • 8443 views

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

    Best answer by LucMeekes

    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

    3 replies

    5-Regular Member
    January 24, 2019

    Use WRITEEXCEL function, or Excel Component.

    23-Emerald IV
    January 25, 2019
    Note that the OP posted his question over three months ago...

    Luc
    23-Emerald I
    January 25, 2019

    @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
    January 25, 2019

    @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.

    Capture.PNG

    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:

    Capture1.PNG

    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:

    Capture2.PNG

    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!

     

    1-Visitor
    January 25, 2019

    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

     

     

     

    1-Visitor
    January 28, 2019

    and that's what I wanted.

    thank you Luc

    25-Diamond I
    January 25, 2019

    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!!!!

    B.png

     

    23-Emerald I
    January 25, 2019

    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!

    25-Diamond I
    January 25, 2019

    @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.