在Maple17中提取等高线图的数据点

时间:2018-01-25 11:06:51

标签: maple

我正在使用Maple(17)。我是新手,我需要学习或了解如何将原始数据或数据点从等高线图(2d图)提取到文本文件或其他任何内容,但只需获取数据,然后在其他软件中绘图。 / p>

1 个答案:

答案 0 :(得分:0)

Maple的2D绘图命令用Maple自己的语言构造函数调用,可以使用stock命令检查(例如nopsoplprintselect等)。

当然,这些PLOT函数调用(作为数据结构的服务器)的内容的布局和性质根据特定的绘图命令产生它们而变化。

以下是PLOT命令返回的plots:-contourplot函数调用内容的一些基本内容。

restart;

P := plots:-contourplot( sin(x)*y^2,
                         x=-Pi..Pi, y=-1..1,
                         contours=[-1/2,-1/7,1/7,1/2],
                         grid=[39,39] ):

# The GUI prints the PLOT structure by rendering it graphically.
P;

enter image description here

# Data for 2D curves are stored within substructures that are
# function calls to the name `CURVES`.
Pdata := select( type, [op(P)], specfunc(anything,CURVES) ):

# There are four CURVES within this particular structure
# assigned to P, corresponding to the 4 named contour values.
nops(Pdata);
                    4

# Select only the numeric data, in a list.
C1 := select( type, [op(Pdata[1])], list(list(numeric)) ):

# There happen to be 78 entries of data.
nops( C1 );
                   78

# Print the first five entries in list C1.
# Each one is a list of two lists. In each such pair
# the two lists each contain two floats, representing
# x and y coordinates of a point.
# Each list of two points represents a line segment.
# This first CURVE is stored as 78 individual line segments
# (but here is the end-point data for 5 of those).

map(print, C1[1..5]):

[[0.524804672715281, -1.], [0.560425257062589, -0.967862584000641]]
[[0.593087222168692, -0.947368421052632], [0.560425257062589, -0.967862584000641]]
[[0.593087222168692, -0.947368421052632], [0.611600658135984, -0.931520641144355]]
[[0.661387927071535, -0.902063357909845], [0.611600658135984, -0.931520641144355]]
[[0.661387927071535, 0.902063357909845], [0.593087222168693, 0.947368421052631]]

您可以查看命令ExportwritedatafprintfExportMatrix,了解有关将此类数据导出到文件的选项。但当然首先你需要决定你的目标格式。