24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 1607  |  回复: 3
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

lixixiao2

铜虫 (小有名气)

[求助] matlab surf函数的使用

y(i,j)是一个600*3600的矩阵,已经求解出来了,希望用surf函数,将i,j作为函数y的两个自变量表示成图形输出出来,求大神相助。
这是我写的语句:
[i,j]=meshgrid(1:600,1:3600);
for i=1:600
    for j=1:3600
z(i,j)=y(i,j);
    end
end
surf(i,j,z)
但错误很多,运行matlab提示:
??? Error using ==> surf at 78
Data dimensions must agree.

Error in ==> DEEuler at 73
surf(i,j,z)

[ Last edited by lixixiao2 on 2012-10-17 at 10:36 ]
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zsy312

银虫 (小有名气)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★
lixixiao2: 金币+7, ★★★★★最佳答案 2012-11-05 16:55:29
CODE:
[i,j]=meshgrid(1:600,1:3600);
for i=1:600
    for j=1:3600
z(i,j)=y(i,j);
    end
end
i=1:600;
j=1:3600;
surf(i,j,z)

4楼2012-11-04 11:45:55
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 4 个回答

navolo

木虫 (正式写手)

【答案】应助回帖

你的矩阵维数不一致,
关于surf命令与mesh使用类似,你可以看下帮助help surf

help surf
SURF   3-D colored surface.
    SURF(X,Y,Z,C) plots the colored parametric surface defined by
    four matrix arguments.  The view point is specified by VIEW.
    The axis labels are determined by the range of X, Y and Z,
    or by the current setting of AXIS.  The color scaling is determined
    by the range of C, or by the current setting of CAXIS.  The scaled
    color values are used as indices into the current COLORMAP.
    The shading model is set by SHADING.

    SURF(X,Y,Z) uses C = Z, so color is proportional to surface height.

    SURF(x,y,Z) and SURF(x,y,Z,C), with two vector arguments replacing
    the first two matrix arguments, must have length(x) = n and
    length(y) = m where [m,n] = size(Z).  In this case, the vertices
    of the surface patches are the triples (x(j), y(i), Z(i,j)).
    Note that x corresponds to the columns of Z and y corresponds to
    the rows.

    SURF(Z) and SURF(Z,C) use x = 1:n and y = 1:m.  In this case,
    the height, Z, is a single-valued function, defined over a
    geometrically rectangular grid.

    SURF(...,'PropertyName',PropertyValue,...) sets the value of the
    specified surface property.  Multiple property values can be set
    with a single statement.

    SURF(AX,...) plots into AX instead of GCA.

    SURF returns a handle to a surface plot object.

    AXIS, CAXIS, COLORMAP, HOLD, SHADING and VIEW set figure, axes, and
    surface properties which affect the display of the surface.

    Backwards compatibility
    SURF('v6',...) creates a surface object instead of a surface plot
    object for compatibility with MATLAB 6.5 and earlier.
   
    See also surfc, surfl, mesh, shading.

    Overloaded functions or methods (ones with the same name in other directories)
       help sweepset/surf.m

    Reference page in Help browser
       doc surf
2楼2012-10-30 22:07:50
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

wurongjun

专家顾问 (职业作家)

【答案】应助回帖

★ ★ ★
lixixiao2: 金币+3, ★★★很有帮助 2012-11-02 09:39:54
没有大的错误!
不过是:i,j这两个变量已经在织网时用过了,后面循环再用就出错了!
           如果Y(i,j)知道直接用suf(i,j,y)就可以,不用赋值给z!
善恶到头终有报,人间正道是沧桑.
3楼2012-10-30 22:25:41
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[硕博家园] 求调剂 有机化学考研356分 +11 Nadiums 2026-03-25 12/600 2026-03-31 18:24 by oooqiao
[考研] 本2一志愿C9-333分,材料科学与工程,求调剂 +9 升升不降 2026-03-31 9/450 2026-03-31 18:01 by 无际的草原
[考研] 环境工程 085701,267求调剂 +13 minht 2026-03-29 13/650 2026-03-31 17:47 by 544594351
[考研] 材料工程专硕求调剂 +10 hyl3153942 2026-03-29 10/500 2026-03-31 16:31 by hypershenger
[考研] 材料科学与工程调剂 +13 深V宿舍吧 2026-03-30 14/700 2026-03-31 16:28 by hypershenger
[考研] 334分 一志愿武理-080500 材料求调剂 +9 李李不服输 2026-03-25 9/450 2026-03-31 16:25 by hypershenger
[考研] 一志愿哈尔滨工业大学材料与化工方向336分 +13 辰沐5211314 2026-03-26 13/650 2026-03-31 14:37 by 记事本2026
[考研] 081200-11408-276学硕求调剂 +4 崔wj 2026-03-31 4/200 2026-03-31 11:56 by jp9609
[考研] 313求调剂 +6 卖个关子吧 2026-03-31 6/300 2026-03-31 10:58 by Jaylen.
[考研] 22408 359分调剂 +4 Qshers 2026-03-27 8/400 2026-03-31 08:53 by Qshers
[考研] 英一数一408,总分284,二战真诚求调剂 +3 12.27 2026-03-30 5/250 2026-03-31 00:47 by 不吃芒果17
[考研] 各位老师好,我的一志愿为北京科技大学085601材料专硕 +10 Koxui 2026-03-28 10/500 2026-03-30 19:33 by 源_2020
[考研] 105500药学求调剂,一志愿山东大学药学,348分 +3 gr哈哈哈 2026-03-28 3/150 2026-03-30 18:56 by 源_2020
[考研] 343求调剂 +6 爱羁绊 2026-03-29 6/300 2026-03-29 12:00 by 无际的草原
[考研] 085600,专业课化工原理,321分求调剂 +5 大馋小子 2026-03-28 5/250 2026-03-29 08:56 by qingfeng258
[考研] 材料求调剂一志愿哈工大324 +7 闫旭东 2026-03-28 9/450 2026-03-28 08:51 by Xu de nuo
[考研] 一志愿吉大071010,316分求调剂 +3 xgbiknn 2026-03-27 3/150 2026-03-27 10:36 by guoweigw
[考研] 调剂求收留 +7 果然有我 2026-03-26 7/350 2026-03-27 00:26 by wxiongid
[考研] 调剂 +4 柚柚yoyo 2026-03-26 4/200 2026-03-26 20:43 by fmesaito
[考研] 347求调剂 +4 L when 2026-03-25 4/200 2026-03-25 13:37 by cocolv
信息提示
请填处理意见