Adept Scientific - English
The world's best software and hardware for research, science and engineering.
flag arrow
clearclear

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKdedksvnofi
Home
Products
Training
Events
 Buy Online
Downloads
Academic Discounts
Support
My Adept
International |  About Us |  Adept Scientific Blog |  Contact Us |  Press Room |  Jobs
Adept Scientific on Facebook Adept Scientific on Twitter Adept Scientific on YouBube Adept Scientific on LinkedIn


The Next Steps

• Ask us a question
• Watch Maple Video Demonstrations
• Buy Maple Now
• View Maple Pricing
• Download a Brochure
• Request a Brochure
• Request an Evaluation
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 16 Overview
Maple 16 Professional
Maple 16 Academic
Maple 16 Student Use
What's New in Maple 16
Maple New Features
Datasheet

Maple History
Recorded Online Seminars

MapleSim
MapleNet
Maple T.A.
BlockImporter™
Maple Toolboxes

Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Latest Information

New Features: Professional
New Features: Academic
Maple Features
The Maple Reporter Online

Service & Support

Maple Primes
blogs, forums etc

Elite Maintenance Program
Application Centre
Powertools
Search the Knowledge Base
Technical Support request

List Archives >  Maple User Group List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[MUG] Re: listplot3d

Search email archive for  

[MUG] Re: listplot3d
Author: Carl DeVore    Posted: 11/01/2001 00:31:31 GMT
>> From: Carl DeVore

| >>>From: "Ismail Boztosun"
|
| I need to obtain a 3D plot by using a data file. I could not find any
| other way that to use " listplot3d " but it seems that this accepts only
| heights arrays, namely a rectangular array containing the heights of the
| surface. In this way I cannot obtain the right scales on the x a y axis
| because the x and y data are not considered!
|
| Is there any way to plot a real three-dimensional set of data written as
| a set of {x,y,z} points?

I avoided answering this question earlier because I was hoping that
someone could give a better answer than me. Yesterday's answers all
suggested either using pointplot3d or surfdata (or not using Maple at
all). I don't think that either pointplot3d or surfdata are quite
satisfactory. The problem with pointplot3d is that you need a tremendous
number of points to get a reasonable looking surface. The problem with
surfdata is that the data needs to sorted on both the x and y coordinates
and subdivided into a triply nested list (a "listlistlist" as it were,
rather than the "listlist" form that data is currently in). Surfdata was
intended to be used when there are a fixed number n of x-values and a
fixed number m of y-values and a total of n*m points. These values define
the gridlines. But it is not absolutely necessary that the x and y values
are fixed as long as they are sorted. Example:

> f:= (x,y) -> sin(x*y);
> plot3d(f, 0..5, 0..5, style= patchnogrid);

As you can see (if you enter this code), this is a moderately complex
surface. By default, the plot3d command evaluates the function at 25x25
= 625 points: 25 x values by 25 y values. I will randomly sample the
surface at 4 times this number of points and construct a close
approximation to the original plot.

> k:= 50:
> M:= matrix(k^2,3):
> for n to k^2 do
> x:= evalf(5*rand()/10^12);
> y:= evalf(5*rand()/10^12);
> M[n,1]:= x; M[n,2]:= y;
> M[n,3]:= f(x,y);
> end:
> M:= convert(M,listlist):

Now M is in exactly the listlist form that it would be in had you read it
from a file with the readdata command.

Let's look at a pointplot:
> pointplot3d(M);

The picture is so sparse that it is barely visible. If we increase the
size of the points (or use a different style, like circle), the plot is
much too blurry.

Sort M by the y-coordinates:
> M:= sort(M, (p1,p2) -> evalb(p1[2]<p2[2])):

Now I will assume that we have n*m points for some reasonably close values
of n and m. In my example, n = m = k = 50.

> n:= k; m:= k;

Now we divide the list into chunks of length n and sort each chunk on the
x-coordinate. Then plot the whole.

> plots[surfdata]
> ([seq(sort(M[j*n+1..j*(n+1)], (p1,p2) -> evalb(p1[1]<p2[1]))
> ,j= 0..m-1
> )]
> ,style=patchnogrid
> );

I think that that's a pretty good approximation to the original surface.
If you put the grid lines in, they will still be a mess, which is why I
specified "patchnogrid".

A more sophisticated approach would be to define a mesh of x and y values
and replace each x and y value with the closest mesh point. Of course
this is unnecessary if your original data are already on a mesh. In this
case, the grid lines will look fine. But the above code is still
necessary in order to put the data into the format required by the
surfdata command.

If the x and y values are moved to mesh values, would it then be possible
to somehow interpolate the z-values? I know nothing about interpolating
multidimensional functions.


Carl Devore
University of Delaware

[View Complete Thread]



Previous by date: [MUG] Re: Double Integral problem with discontinuity, Maple Group
Next by date: [MUG] Re: Double Integral problem with discontinuity, Tanaka
Previous thread: [MUG] color eps, Maths
Next thread: [MUG] Re: Double Integral problem with discontinuity, Maple Group



Ready to buy?

For more pricing information:
Visit our webstore, call us on +1 800 724 8380 or email us at info@adeptscience.com

Featured Downloads

Maple 16 & MapleSim 5 Professional Brochure
Maple 16 Academic Datasheet
Maple 16 & MapleSim 5 Academic Brochure
Maple 16 What is New datasheet
Maple 16 Professional Datasheet
Maple Whitepaper: Driving Innovation - How mathematical modeling and optimisation increase efficiency and productivity in vehicle design.
MapleSim Whitepaper - Technological Superiority in Multi-Domain Physical Modelling and Simulation

Latest Downloads

Maple 16 Programming Guide
Maple 16 User Manual
Maple 16 Academic Datasheet
Maple 16 Professional Datasheet
Maple 16 & MapleSim 5 Academic Brochure

Product Reviews

"Without the Maple software, we would have to spend weeks generating the equations of motion for every experiment. Then the chances that we did it right would basically be near zero. There would always be a mistake somewhere. It is very difficult to set up a dynamic motion model by hand."
- Jean-Claude PiedBeouf, Ph.D Manager of Robotics, Canadian Space Agency

"Its very good - highly accurate and easy to use. The speed of Maple allows me to change equations and quickly reintegrate them into the application, so more possibilities can be explored to achieve the precise effect desired."
Shawn Neely, Senior R & D Director for PDI/Dreamworks

Latest News

Connectivity to major CAD systems extended in Maple 16
MapleSim Breaks New Ground in Hardware-in-the-Loop real-time simulation for planetary rovers
MapleSim Breaks New Ground in Hardware-in-the-Loop real-time simulation for planetary rovers
Maths software usability reaches new heights with Maple 16
"MapleSim was an eye-opener for us.
adept

Top of the Page

Popular Links: ChemDraw | ChemOffice | Data Acquisition | Data Analysis | EndNote | Maple | MapleSim | Mathcad | MathType | Quality Analyst | Reference Manager | VisSim

EU ePrivacy Directive | Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2012, Adept Scientific plc.
Site designed and maintained by Lyndon Ash

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055