24小时热门版块排行榜    

查看: 1164  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[论文投稿] 你的学校职称晋升认CSCD吗? +3 wowsunflower 2024-09-26 3/150 2024-09-29 03:20 by lyd782
[考博] 请问大家,我有希望进浙大普博么 +5 高艺文 2024-09-28 8/400 2024-09-29 00:08 by 小红豆
[论文投稿] applied catalysis B 投稿模版 5+4 午后夏日 2024-09-27 5/250 2024-09-28 22:59 by 莱茵润色
[硕博家园] 希望有师兄师姐帮忙引荐申博 +6 zhanyaqian 2024-09-25 11/550 2024-09-28 22:24 by 自强2019
[教师之家] 东南大学电气学院电力电子方向招收硕士博士 +4 蜡笔小鑫1989 2024-09-26 7/350 2024-09-28 21:16 by 伍文童
[基金申请] QB怎么还没消息 +21 wuxiacl 2024-09-24 57/2850 2024-09-28 14:48 by xiaoxiao270
[论文投稿] 求推荐医学类杂志 35+4 wshxtim1 2024-09-25 4/200 2024-09-28 13:56 by Wormaciae
[教师之家] 西湖大学教授:我可以自由地选择讲课的方式, 讲授的角度 +4 zju2000 2024-09-22 4/200 2024-09-28 09:40 by bio-polymer
[考博] 材料/电信/生物-2025普博生自荐-985本双非硕一区一作 +4 enowei0127 2024-09-23 8/400 2024-09-27 22:40 by enowei0127
[基金申请] 请问大家的计划书填写列表中状态更新了吗? +7 Laker610 2024-09-25 9/450 2024-09-27 16:36 by 田田hj
[教师之家] 压力山大 +17 暮色恋伊人 2024-09-24 25/1250 2024-09-27 16:10 by 领先于123
[硕博家园] 当前读博士还有性价比吗? +8 苏东坡二世 2024-09-23 8/400 2024-09-27 11:39 by 半生梦君
[有机交流] 二氯甲烷的去除 +3 cgsa吧 2024-09-24 8/400 2024-09-27 10:55 by bear2007
[有机交流] 请问胺的盐酸盐中氯化氢的氢会在核磁氢谱中出峰吗? +3 rommel1975 2024-09-25 4/200 2024-09-26 13:07 by 091602
[论文投稿] NC投稿多久有消息呀? +4 Jordanblood 2024-09-24 6/300 2024-09-25 16:58 by FZX_2024
[论文投稿] laser physics期刊投稿 5+3 mengxiangcz 2024-09-23 6/300 2024-09-25 15:08 by mengxiangcz
[有机交流] chemdraw结构式复制到word变形 +5 笑看人生1993 2024-09-22 11/550 2024-09-25 14:44 by 冰蓝夜游神
[论文投稿] SCI投稿状态 25+4 jorden8 2024-09-23 6/300 2024-09-25 10:24 by jorden8
[论文投稿] 爱斯维尔旗下Postharvest Biology and Technology,采用什么系统查查 20+4 sdsdsxh 2024-09-22 9/450 2024-09-25 07:33 by sdsdsxh
[有机交流] 做聚酰亚胺一步法合成,机械搅拌怎么密封不漏气 +3 哼哈EN 2024-09-24 5/250 2024-09-24 14:16 by mrzhl1986
信息提示
请填处理意见