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

3d surface plot from excel data?

ccallaway
Newbie

3d surface plot from excel data?

Hello,

I am brand new to Mathcad so I apologize if this is an easy question.  I've been through the help, and the tutorials and have had no luck.

I have a simple spreadsheet in excel of histogram data (small sample below).  The top row represents the Y index, measuring the value of each histogram bucket.

The left-most column represents timestamps for each sample of data -- the X index.

The values in each cell represent the number of occurrences for a given value (bucket, Y index) at a given timestamp -- the Z index.

I would like to import this data into Mathcad and create a 3d surface plot.  I know how to get the data into Mathcad, but all I get is a blank graph.  Does anyone have any examples or tutorials of how to do this?  Surely this is a common need.

Thank you.

   

12481632
17:01-17:3016709957571265809661907817427216244
17:30-18:0015465029173874679686224820159204462
18:00-18:301639341150381876487842331109512339081
18:30-19:00154692713211872679649977866845238341
19:00-19:30108709116726667597292952503678210493
19:30-20:0081336217759778544388717693704299647
Tags (1)
5 REPLIES 5

Re: 3d surface plot from excel data?

I'm assuming you're using Prime.  Attached is Prime 3.0, readable in 3.1 or 4.0.

Technique works in Mathcad 15 as well, much more control over plot appearance.

Re: 3d surface plot from excel data?

This is similar to Fred's.  Except some different plots.  3D plots as Fred made seem to be restricted to having the X and Y simply be counters (1,2,3, etc)  The contour plot isn't what you asked for, but may be the most visual.

3d.jpg

Re: 3d surface plot from excel data?

Here's an extension with a mesh.  And I think I had my Z_i,j backwards.  mesh2.jpg

Re: 3d surface plot from excel data?

Please attach the actual File.

I'm very interrested in creating meshs with programming and Vektors.

I want to do this with data from my Garmin device when cycling tours are finished.

Wanna see the Altitude in the contour-Plot.

...beeing not really familiar with this programming...

Thank you!

Volker

Volker

Re: 3d surface plot from excel data?

Always state which version (and subversion) of Mathcad you are using! Prime or real Mathcad. If Prime then its very important to state the exact version, as they are incompatible (at least they are not compatible in a useful way).

Also it would always help if you attach your worksheet.

I guess you know how to get your excel data in Mathcad and how to split row- and column-header and data.

You could plot your data right away but have to take into account a lot of drawbacks.

You lose the information about x (time) and Y. Those values are substituted by the sequence 0,1,2,3,4,5.

Because of this you see a wrong (logarithmic) scale in y direction!

Depending on what you are looking for there a different approaches.

You may want to interpolate your data, turning the table into a function.

Simplest form is linear interpolation:

More sophistic is using splines for interpolation

Mathcad offer three different flavors for cubic splines - cspline, pspline, lspline.

As you can see, I used cspline. If you change that for lspline the result should be the very same as if using the built-in Bicubic2D.

There is a slight difference between the two as you can see in the attached sheet.

The data used by Mathcad to show a 3d surface is a little bit complicated and consists of three nested matrices. Here is a way to build that structure from row-, column-header and data table and then plot the pure data:

Attached file in format Prime 3.0.

P.S.: I am not sure what Fred intended as in fact he simply put two columns in front of the data table (accidentally overwriting the first data column) which means we plot wrong data, I guess.

dferry in his first reply (apart from using differently scaled data) simply created a three column matrix - a long list of points.

That way he is losing completely the mesh information - which point is neighbor of which.

I asked here in the past quite a few time if anybody would know which kind of function Mathcad would try to fit over just a bunch of data points if asked to do a surface plot (I think Prime refuses to do so, nevertheless happily provides a contour plot?). So far nobody could answer that question. What we know is that its not an interpolation but rather an approximation. The surface Mathcad creates usually does not include the datapoints exactly but rather follows them as good as it can (whatever that may mean).

Therefore I guess its not a good idea to abandon the mesh-information. Even though dferry did not create a surface plot in his first answer he showed a contour plot, which also would force Prime to create some kind of surface.

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."