24小时热门版块排行榜    

查看: 1529  |  回复: 7
当前主题已经存档。
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

phyfriday

金虫 (小有名气)

[交流] 【求助】20金求助matlab中contour plot命令的源码

急切求教各位高手,如何获知matlab中等高线命令--contour的算法或源代码?
回复此楼
光学--红外激光器
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

phyfriday

金虫 (小有名气)

谢谢3楼、4楼。
这个我也试过了,可是生成等高线的核心函数----h = specgraph.contourgroup('parent',parax,pvpairs{:})怎么才能调出来?对应于同一高度,利用contour命令生成等高线有许多条,现在我想对对这些等高线逐条提取,大概1000多条,并且使每条含有大致相同的点,所以必须看到生成等高线的原始代码,才对我有帮助。还希望各位帮忙!
光学--红外激光器
5楼2009-04-28 09:18:34
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 8 个回答

coldwind042

金虫 (正式写手)

也想知道,帮你顶!
2楼2009-04-27 13:44:23
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

hitzhang

木虫 (正式写手)

★ ★ ★ ★ ★
sunxiao(金币+3,VIP+0):thank you 4-28 05:24
phyfriday(金币+2,VIP+0):谢谢 4-28 09:19
function [cout, hand] = contour(varargin)
%CONTOUR Contour plot.
%   CONTOUR(Z) is a contour plot of matrix Z treating the values in Z
%   as heights above a plane.  A contour plot are the level curves
%   of Z for some values V.  The values V are chosen automatically.
%   CONTOUR(X,Y,Z) X and Y specify the (x,y) coordinates of the
%   surface as for SURF. The X and Y data will be transposed or sorted
%   to bring it to MESHGRID form depending on the span of the first
%   row and column of X (to orient the data) and the order of the
%   first row of X and the first column of Y (to sorted the data). The
%   X and Y data must be consistently sorted in that if the first
%   element of a column of X is larger than the first element of
%   another column that all elements in the first column are larger
%   than the corresponding elements of the second. Similarly Y must be
%   consistently sorted along rows.
%   CONTOUR(Z,N) and CONTOUR(X,Y,Z,N) draw N contour lines,
%   overriding the automatic value.
%   CONTOUR(Z,V) and CONTOUR(X,Y,Z,V) draw LENGTH(V) contour lines
%   at the values specified in vector V.  Use CONTOUR(Z,[v v]) or
%   CONTOUR(X,Y,Z,[v v]) to compute a single contour at the level v.
%   CONTOUR(AX,...) plots into AX instead of GCA.
%   [C,H] = CONTOUR(...) returns contour matrix C as described in
%   CONTOURC and a handle H to a contourgroup object.  This handle can
%   be used as input to CLABEL.
%
%   The contours are normally colored based on the current colormap
%   and are drawn as PATCH objects. You can override this behavior
%   with the syntax CONTOUR(...,LINESPEC) to draw the contours
%   with the color and linetype specified. See the help for PLOT
%   for more information about LINESPEC values.
%
%   The above inputs to CONTOUR can be followed by property/value
%   pairs to specify additional properties of the contour object.
%
%   Uses code by R. Pawlowicz to handle parametric surfaces and
%   inline contour labels.
%
%   Example:
%      [c,h] = contour(peaks); clabel(c,h), colorbar
%
%   See also CONTOUR3, CONTOURF, CLABEL, COLORBAR, MESHGRID.

%   Additional details:
%
%   CONTOUR uses CONTOUR3 to do most of the contouring.  Unless
%   a linestyle is specified, CONTOUR will draw PATCH objects
%   with edge color taken from the current colormap.  When a linestyle
%   is specified, LINE objects are drawn.
%
%   Thanks to R. Pawlowicz (IOS) rich@ios.bc.ca for 'contours.m' and
%   'clabel.m/inline_labels' so that contour now works with parametric
%   surfaces and inline contour labels.

%   Copyright 1984-2007 The MathWorks, Inc.
%   $Revision: 5.18.4.18 $  $Date: 2007/11/13 00:10:21 $

[v6,args] = usev6plotapi(varargin{:},'-mfilename',mfilename);
if v6
  [c,h] = Lcontourv6(args{:});
else
  % Parse possible Axes input
  error(nargchk(1,inf,nargin,'struct'));
  [cax,args] = axescheck(args{:});
  [pvpairs,args,msg] = parseargs(args); %#ok
  if ~isempty(msg), error(msg); end %#ok
  
  if isempty(cax) || isa(handle(cax),'hg.axes')
      cax = newplot(cax);
      parax = cax;
      hold_state = ishold(cax);
  else
      parax = cax;
      cax = ancestor(cax,'Axes');
      hold_state = true;
  end

  h = specgraph.contourgroup('parent',parax,pvpairs{:});
  set(h,'refreshmode','auto');
  c = get(h,'contourmatrix');
  
  if ~hold_state
    view(cax,2);
    set(cax,'box','on','layer','top');
    grid(cax,'off')
  end
  plotdoneevent(cax,h);
  h = double(h);
end

if nargout > 0
    cout = c;
    hand = h;
end

function [c,h] = Lcontourv6(varargin)  
% Parse possible Axes input
error(nargchk(1,6,nargin,'struct'));
[cax,args] = axescheck(varargin{:});

cax = newplot(cax);

[c,h,msg] = contour3(cax,args{:});
if ~isempty(msg), error(msg); end %#ok

set(h,'ZData',[]);

if ~ishold(cax)
  view(cax,2);
  set(cax,'Box','on');
  grid(cax,'off')
end

function [pvpairs,args,msg] = parseargs(args)
msg = '';
% separate pv-pairs from opening arguments
[args,pvpairs] = parseparams(args);

% check for special string arguments trailing data arguments
if ~isempty(pvpairs)
  [l,c,m,tmsg]=colstyle(pvpairs{1}); %#ok
  if isempty(tmsg)
    args = {args{:},pvpairs{1}};
    pvpairs = pvpairs(2:end);
  end
  msg = checkpvpairs(pvpairs);
end

nargs = length(args);
x = [];
y = [];
z = [];
if ischar(args{end})
  [l,c,m,tmsg] = colstyle(args{end}); %#ok
  if ~isempty(tmsg),
    msg = sprintf('Unknown option "%s".',args{end});
  end
  if ~isempty(c)
    pvpairs = {'linecolor',c,pvpairs{:}};
  end
  if ~isempty(l)
    pvpairs = {'linestyle',l,pvpairs{:}};
  end
  nargs = nargs - 1;
end
if (nargs == 2) || (nargs == 4)
  if (nargs == 2)
    z = datachk(args{1});
    pvpairs = {'zdata',z,pvpairs{:}};
  else
    x = datachk(args{1});
    y = datachk(args{2});
    z = datachk(args{3});      
    pvpairs = {'xdata',x,'ydata',y,'zdata',z,pvpairs{:}};
  end
  if (length(args{nargs}) == 1) && (fix(args{nargs}) == args{nargs})
    % N
    zmin = min(real(double(z()));
    zmax = max(real(double(z()));
    if args{nargs} == 1
      pvpairs = {'levellist',(zmin+zmax)/2, pvpairs{:}};
    else
      levs = linspace(zmin,zmax,args{nargs}+2);
      pvpairs = {'levellist',levs(2:end-1),pvpairs{:}};
    end
  else
    % levels
    pvpairs = {'levellist',unique(args{nargs}),pvpairs{:}};
  end
elseif (nargs == 1)
  z = datachk(args{1});
  pvpairs = {'zdata',z,pvpairs{:}};
elseif (nargs == 3)
  x = datachk(args{1});
  y = datachk(args{2});
  z = datachk(args{3});
  pvpairs = {'xdata',x,'ydata',y,'zdata',z,pvpairs{:}};
end
% Make sure that the data is consistent if x and y are specified.
if ~isempty(x)
    msg = xyzcheck(x,y,z);
end
if ~isempty(z) && isempty(msg)
    k = find(isfinite(z));
    zmax = max(z(k));
    zmin = min(z(k));
    if ~any(k)
        warning('MATLAB:contour:NonFiniteData','Contour not rendered for non-finite ZData');
    elseif isempty(z) || (zmax == zmin)
        warning('MATLAB:contour:ConstantData','Contour not rendered for constant ZData');
    end
end
args = [];
3楼2009-04-27 19:17:52
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

woshilsh

荣誉版主 (职业作家)

优秀版主

★ ★ ★
sunxiao(金币+2,VIP+0):thank you 4-28 05:25
phyfriday(金币+1,VIP+0):谢谢 4-28 09:19
楼上正解,直接找Help文件,或者在命令窗口打开嘛
[center][url=http://www.91cool.net/][img]http://id.91cool.net/sign/?name=小木虫印&say=各位版主辛苦了![/img][/url][/center]
4楼2009-04-27 19:41:10
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 小木虫上这么多卖论文的,真有人买论文么?感觉没必要啊 +3 Tide man 2026-08-10 3/150 2026-08-10 21:48 by GZUZM
[基金申请] 帮忙看看fileCode +4 wwncly 2026-08-10 7/350 2026-08-10 21:24 by Tide man
[基金申请] FileCode能看出啥? +7 要乐观耀哥 2026-08-10 15/750 2026-08-10 19:29 by 要乐观耀哥
[基金申请] filecode +8 documentary 2026-08-10 8/400 2026-08-10 19:20 by loufangrui
[基金申请] 关于代码变化问题,想知道的进来 +17 且听虎啸 2026-08-07 24/1200 2026-08-10 18:35 by zhangduo2008
[基金申请] 为什么网上很多人说本周 12号出结果 +3 瞬息宇宙 2026-08-10 3/150 2026-08-10 18:27 by Tide man
[基金申请] 我的国基提前知道中了,可是同事的操作让我实在接受不了,怎么会有这样的人 +8 家与远方 2026-08-10 11/550 2026-08-10 17:09 by 六两废铜
[基金申请] 国自然结果 +4 Vierhys 2026-08-10 8/400 2026-08-10 15:06 by Vierhys
[基金申请] 面上项目filecode邪修 +5 西山十月 2026-08-09 7/350 2026-08-10 07:32 by 仁砚薪传
[基金申请] filecode与中标关系的预测 +5 布布和一二 2026-08-07 5/250 2026-08-09 16:15 by 袁向阳007
[基金申请] fileCode有新解读? +10 Tide man 2026-08-08 18/900 2026-08-09 12:55 by 仁砚薪传
[基金申请] 关于filecode,很负责任的告诉大家 +6 爱看书的可乐 2026-08-08 7/350 2026-08-08 22:13 by a_niu
[基金申请] 关于豆爷回答的JTJC与%2F数量 +5 yang182083 2026-08-06 7/350 2026-08-08 18:29 by zhanghaozhu
[基金申请] 娱乐 +6 Tide man 2026-08-03 6/300 2026-08-07 22:40 by 铁帽子农民
[基金申请] 固定端突然变了,今天 +6 archvillain 2026-08-06 10/500 2026-08-07 16:03 by 医学老男孩
[基金申请] filecode变化情况 +6 布布和一二 2026-08-07 22/1100 2026-08-07 14:45 by 且听虎啸
[基金申请] 大家散了吧,后缀研究没有意义,别浪费时间了,过好目前的每一天,不要焦虑 +5 Tide man 2026-08-06 7/350 2026-08-07 13:11 by 医学老男孩
[基金申请] filecode +8 布布和一二 2026-08-06 11/550 2026-08-06 20:41 by tangpu318
[基金申请] 影响面上的因素 +8 布布和一二 2026-08-05 11/550 2026-08-06 10:41 by 宝贝虫子
[基金申请] 有没有H口的?有收到消息的吗? +3 超级海虾 2026-08-04 3/150 2026-08-04 17:26 by 学教育滴
信息提示
请填处理意见