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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

help!.. how can i plot a 3d surface graph from 3 columns of data i've got in excel?

dnorman
1-Visitor

help!.. how can i plot a 3d surface graph from 3 columns of data i've got in excel?

hi, this can't be hard can it?.. am new to mathcad and am trying to import 3 columns x12 rows of excel data by copy/paste into a table and/or a matrix etc with the intention of plotting on a 3d surface graph

...I can paste the values into the mathcad matrix ok but can't seem to assign a variable name to the matrix... so graph can't load it (nor can anything else refer to it I suppose)

...the table rows/columns aren't read in from the excel data - they are presumed 0, 1, 2 etc - so axes are preset to 0, 1, 2... rather than 1st 2 columns of data in excel file - graph just plots 3 columns of data imported as if they were functions f({0, 1, 2}, {0, 1, 2})... which seems a bit dim ...(my 3 columns in excel are the x, y, z) function should be {excel col3} = f({excel col1}, {excel col2})

I must be missing something obvious - can anyone help?

lots of thanks

10 REPLIES 10

In version 15, it's not hard:

  1. select the data in EXCEL and copy
  2. In version 15, type your matrix name and :=, then paste.  And you have your matrix.

In Prime, I believe it's a bit more complicated.  Insert an EXCEL component, paste the data into the component, and define your matrix from the component.

StuartBruff
23-Emerald III
(To:dnorman)

dave norman wrote:

hi, this can't be hard can it?.. am new to mathcad and am trying to import 3 columns x12 rows of excel data by copy/paste into a table and/or a matrix etc with the intention of plotting on a 3d surface graph

...I can paste the values into the mathcad matrix ok but can't seem to assign a variable name to the matrix... so graph can't load it (nor can anything else refer to it I suppose)

...the table rows/columns aren't read in from the excel data - they are presumed 0, 1, 2 etc - so axes are preset to 0, 1, 2... rather than 1st 2 columns of data in excel file - graph just plots 3 columns of data imported as if they were functions f({0, 1, 2}, {0, 1, 2})... which seems a bit dim ...(my 3 columns in excel are the x, y, z) function should be {excel col3} = f({excel col1}, {excel col2})

I must be missing something obvious - can anyone help?

lots of thanks

thanks for this - it's a brilliant reply!..

it's almost exactly what I wanted to do... but just one last thing... the x, y axes are labelled according to the row/column number of the data - can the x/y axes range be labelled from the min/max x, y values in the matrix array instead? (i.e. if the x value was say temperature, it would make sense to have the x-axis showing the temperature range, not just which row/column the data came from...)

ok.. hope clear to understand

StuartBruff
23-Emerald III
(To:dnorman)

dave norman wrote:

thanks for this - it's a brilliant reply!..

it's almost exactly what I wanted to do... but just one last thing... the x, y axes are labelled according to the row/column number of the data - can the x/y axes range be labelled from the min/max x, y values in the matrix array instead? (i.e. if the x value was say temperature, it would make sense to have the x-axis showing the temperature range, not just which row/column the data came from...)

ok.. hope clear to understand

seperate each column with a column and wrap parentheses around the 3 columns.

Stuart

ughhh... how do I separate each column with a column and wrap parentheses around them?.. (btw here is my x,y,z dataset)

I don't know what key strokes needed to do this... sorry

dnorman
1-Visitor
(To:dnorman)

ok... have found out how this works now...

1) insert table -

2) type the name "data" in the square before the ":=" sign

2) click on the table and stretch object with mouse to give 3 columns and lots of rows

3)  in EXCEL copy the data into the clipboard using CTRL-C

4) in the MATHCAD table, select all the cells with the mouse (click on top LH cell, hold down SHIFT and then click on bottom RH cell)

5) paste the EXCEL data using CTRL-V

6) insert a graph - select a 3d surface... you will see this...

in the red square, type this...

then click in the space between the 1st data and the comma, and type CTRL-6... you get this funny <> appearing, which I understand represents a column of data in a multi-dimensional table or matrix... (think of it as an EXCEL column)...

..so do this with all of the data entries...

then type in 0, 1, 2 as shown...

and the 3d surface appears like magic - it's a surface which covers the data like a table cloth - it passes exactly through all the points in the table - but also covers the space in between - I'm not sure but it's probably based on a spline surface)

...only complaints with it are:

1) axes automatically start from zero rather than from the min data in each column- this seems illogical to me (after all, if you wanted the axes to start from zero, wouldn't a zero point already be inside the data?)

2) if you switch to another 3d data graph type, i.e. bar graph - the bars are drawn over the entire surface rather than just the at data points you had - this means your original data is obscured in the fitted surface - I can understand showing the entire surface data is reasonable for a surface plot, but think it doesn't make sense for a bar graph - why not plot the bars only on the original data and enable the 3d surface to be drawn over the top?

3) which brings me to my 3rd question... would be nice if 3d graph types could be superimposed on each other (i.e. a bar graph and a surface plot)

4) the 3d scatter plot is the only method of plotting the original dataset - but this is the least clear way to do it - you just end up with a load of coloured spots in 3d space and when you look at a single point, that you can't tell if it's towards the edges of the cloud of points or in the middle without rotating the cloud of points several times to see how the cloud of points moves relative the point you're looking at (see point 2 - a bar graph of the original data would look better)

in the end I've decided to go back to excel - which is really difficult to arrange the data in such a way that it can be plotted... but at least I can get a plot like this:

which is much better for what I need

...but I'm left feeling disappointed..

ok, I'm very new to Mathcad, and realise I may not know many tricks/clever things Mathcad can do.... so here's a challenge - can anyone do better than my excel plot using Mathcad?

dnorman
1-Visitor
(To:dnorman)

 

oh..sorry,

to help with this... here'e the original data set you can copy directly into a Mathcad data object

130763129
13072028
150770137
155745142
180774172
18072824
18577026
18572218
21077417
21071521
230773161
26076510
dnorman
1-Visitor
(To:dnorman)

..too late - have now written a  macro in excel vba that does the donkey work to prepare the data to plot - so am sticking with excel

Werner_E
25-Diamond I
(To:dnorman)

> can anyone do better than my excel plot using Mathcad?

You would have to define "better".

So far you had not mentioned what you expected to see exactly. You just asked for "plotting a 3d surface graph" and the Excel plot you just showed and seem to be happy with sure is not what I would call a surface plot.

You must keep in mind, that Mathcad is a math program for engineers and while it provides a bunch of functions for data analysis its main goal is not statistics. So the possibilities for pie charts, bar charts etc. are rather limited. 

thanks werner,

Mathcad is quite new to me, and partly, what I'm trying to do is understand it better.  Your reply has helped me a geat deal in this respect, thanks again, Dave

Announcements

Top Tags