24小时热门版块排行榜    

查看: 1192  |  回复: 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的回帖

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的回帖

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的回帖
相关版块跳转 我要订阅楼主 lixixiao2 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[教师之家] 北大教授何怀宏曾如此描述他的同行 +12 zju2000 2024-11-09 12/600 2024-11-15 12:13 by PJ女神
[硕博家园] reject后小感 +6 sioc-sunj 2024-11-14 8/400 2024-11-15 11:50 by 畅21
[考博] 中南大学 粉末冶金国家重点实验室 陈超教授课题组拟招收 1~2位博士研究生通知 +7 中南大学-金属材 2024-11-14 16/800 2024-11-15 11:45 by 李荣东No1
[基金申请] 广东省自然科学基金-面上项目消息有了么? +4 pachang 2024-11-14 6/300 2024-11-15 09:39 by zhoulei7170
[基金申请] 求助 +4 Enenenene 2024-11-15 4/200 2024-11-15 09:36 by 榨菜拌青椒
[论文投稿] 论文返修状态变成了awaiting AE recommendation 10+3 猪小耍 2024-11-13 12/600 2024-11-15 08:41 by 北京莱茵润色
[论文投稿] 找不到审稿人 +5 吉祥如意141913 2024-11-13 5/250 2024-11-15 07:09 by 半生梦君
[硕博家园] 课题和专业一点都不相关怎么办 +7 imt4n9 2024-11-11 10/500 2024-11-15 01:55 by 成长虫
[论文投稿] chemical science和advanced science哪个好一点 +5 yly150 2024-11-12 5/250 2024-11-15 01:09 by ca0yan9
[论文投稿] 投稿系统中的通讯作者和文章中的通讯作者不一样,文章目前被录用了? +4 babybabygo 2024-11-12 5/250 2024-11-14 19:13 by 走了002
[硕博家园] 研究生的生活该是什么样 +4 lqy0719 2024-11-14 4/200 2024-11-14 16:45 by 阿荣喝酒
[硕博家园] 大龄已婚想读博如何 +15 米娅阳 2024-11-11 18/900 2024-11-14 14:18 by xiaomi0401
[找工作] 咨询一下江西的高校待遇,人文氛围怎么样? +5 akslis2024 2024-11-09 5/250 2024-11-14 13:53 by 啄木鸟、
[基金申请] 博后面上出结果了 +5 wl87925139 2024-11-14 5/250 2024-11-14 10:26 by kingmax18996
[论文投稿] 要不要撤稿另投 10+4 wangzhesd 2024-11-09 8/400 2024-11-14 09:09 by LIU_V
[论文投稿] 核心期刊那个阶段最难 +3 公共茅斯 2024-11-11 3/150 2024-11-13 15:27 by 13333105938
[论文投稿] 投稿求助 40+3 liukun11 2024-11-12 4/200 2024-11-12 19:13 by liukun11
[论文投稿] 论文接受后,编辑部发邮件提醒缺少附件 15+4 上善若水明泪 2024-11-10 4/200 2024-11-12 14:24 by 北京莱茵润色
[论文投稿] 爱思唯尔投稿系统里的通讯作者可以和文章里的通讯作者标注不同吗 +7 Omnissiah 2024-11-10 7/350 2024-11-12 14:07 by holypower
[基金申请] 请问:工作单位缺乏条件,青年基金申报书可以写读博学校的实验平台吗? +5 dxmx 2024-11-08 7/350 2024-11-11 23:08 by dxcharlary
信息提示
请填处理意见