matlab获取等高线的数据
(2012-03-02 11:25:39)
标签:
matlab杂谈 |
分类: 学科知识总结 |
另外,若想获得某一等高线处的具体数据,则用[c,h]=contour(X,Y,Z,[i,i]).其中c中即包含等高线的信息,即对应Z=i处的xdata向量和ydata向量。直接调用c就可以了,一般情况下xdata向量和ydata向量过长,显示的时候是分段显示的dim1,dim2...表示接下来一段显示的[xdata,ydata]的长度,如下:
C = [value1 xdata(1) xdata(2)...
为方便查看,调用C'更清晰。
另外,读取任一matlab的fig图的数据的方法如下:
open('D:\design_soft\work\w=60.fig');
Ih=findall(gca,'type','line');
xc=get(Ih,'xdata');
yc=get(Ih,'ydata');
另外注意:contour(Z) draws a
contour plot of matrix Z, where Z is interpreted as heights with
respect to the x-y plane. Z must be at least a 2-by-2 matrix. The
number of contour levels and the values of the contour levels are
chosen automatically based on the minimum and maximum values of Z.
The ranges of the x- and y-axis are
[1:n] and [1:m], where [m,n] = size(Z).
不要颠倒了!故调用时:
i=1;
for a4=-a:delta:a
end
a4=-a:delta:a;
a5=-b:delta:b;
meshgrid(a4,a5);
[c,h]=contour3(a4,a5,f',[0,0]);
%将f转置一下才能和meshgrid(a4,a5)相匹配!