24小时热门版块排行榜    

查看: 2913  |  回复: 18

jiangzi888

新虫 (初入文坛)

[求助] 在matlab中做一点的空间轨迹的三维图,程序报错

在matlab中做一点的空间轨迹的三维图,程序报错,具体错误如下:
??? Error using ==> contourc
Input matrix contains no finite values - unable to calculate contours

Error in ==> contours at 90
    CS = contourc(varargin{numarg_for_call});

Error in ==> contour3 at 112
            [c, msg] = contours(args{1 : nin});

Error in ==> surfc at 62
[cc,hh] = contour3(cax,x,y,z); %#ok

Error in ==> Untitled at 312
surfc(xps,yps,zps)
初学matlab,不知程序哪里出错,请大家指导~
回复此楼

» 猜你喜欢

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

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

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
jiangzi888: 金币+3, ★★★很有帮助 2013-11-26 21:22:14
jiangzi888: 金币+1 2013-11-27 10:52:10
1592203609: 金币+1, 谢谢回帖 2013-11-27 17:21:51
jiangzi888: 金币+1, ★★★很有帮助 2013-11-28 15:50:46
ben_ladeng: 专家考核 2014-01-09 20:19:17
Input matrix contains no finite values - unable to calculate contours
contourc的输入值无效,是不是存在NaN 或者Inf的类型的值,没法画图
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
2楼2013-11-26 19:35:24
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jiangzi888

新虫 (初入文坛)

引用回帖:
2楼: Originally posted by dbb627 at 2013-11-26 19:35:24
Input matrix contains no finite values - unable to calculate contours
contourc的输入值无效,是不是存在NaN 或者Inf的类型的值,没法画图

你好,我程序我有一段存在NaN,是程序中只要出现NaN就一定画不出来么?怎么改才能出图?请赐教,谢谢
3楼2013-11-26 19:54:52
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

引用回帖:
3楼: Originally posted by jiangzi888 at 2013-11-26 19:54:52
你好,我程序我有一段存在NaN,是程序中只要出现NaN就一定画不出来么?怎么改才能出图?请赐教,谢谢...

不一定,mesh作图不受影响,contourc可能要调用这些值就算邻近等高线值,NaN没法计算
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
4楼2013-11-26 21:02:05
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jiangzi888

新虫 (初入文坛)

引用回帖:
4楼: Originally posted by dbb627 at 2013-11-26 21:02:05
不一定,mesh作图不受影响,contourc可能要调用这些值就算邻近等高线值,NaN没法计算...

我把我程序surf命令改成mesh了,结果也是不出图,您看,是不是程序编的有问题?
5楼2013-11-26 22:04:05
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

引用回帖:
5楼: Originally posted by jiangzi888 at 2013-11-26 22:04:05
我把我程序surf命令改成mesh了,结果也是不出图,您看,是不是程序编的有问题?...

不清楚,把程序贴出来看看吧
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
6楼2013-11-26 22:19:32
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jiangzi888

新虫 (初入文坛)

引用回帖:
6楼: Originally posted by dbb627 at 2013-11-26 22:19:32
不清楚,把程序贴出来看看吧...

这个程序是我在论文中看到的,想研究一下。前面是约束点的条件,没贴   
points(i,=[xp,yp,zp];
         i=i+1;
         end
    end
end
Np=points(1:i-1,;

[xp,yp]=meshgrid(-100:2:100,-100:2:100);
rows=101;
xps=[xp;xp];
yps=[yp;yp];
zps=zeros(2*rows,rows);
for I=1:length(Np)
    tx=Np(I,1)/2+51;
    ty=Np(I,2)/2+51;
    tz=Np(I,3);
    if(zps(tx,ty)==0)
       zps(tx,ty)=tz;
       zps(tx+rows,ty)=tz;
    else
       if(tz>zps(tx,ty))
       zps(tx,ty)=tz;
       end
     if(tz<zps(tx+rows,ty))
     zps(tx+rows,ty)=tz;
     end
   end
end
for I=rows:-1:1
      for J=rows:-1:1
       if(zps(I,J)==0)
       continue;
       end
       if(I>1)
             if(zps(I-1,J)==0)
             zps(I-1+rows,J)=zps(I,J);
             xps(I-1+rows,J)=xps(I,J);
             yps(I-1+rows,J)=yps(I,J);
             end  
        end
        if(I<rows)
             if(zps(I+1,J)==0)
             zps(I+l+rows,J)=zps(I,J);
             xps(I+l+rows,J)=xps(I,J);
             yps(I+l+rows,J)=yps(I,J);
             end
         end
          if(J>1)
             if(zps(I,J-1)==0)
             zps(I+rows,J-1)=zps(I,J);
             xps(I+rows,J-1)=xps(I,J);
             yps(I+rows,J-1)=yps(I,J);
             end
          end
          if(J<rows)
             if(zps(I,J+1)==0)
             zps(I+rows,J+1)=zps(I,J);
             xps(I+rows,J+1)=xps(I,J);
             yps(I+rows,J+1)=yps(I,J);
             end
          end
      end
end
for I=rows:-1:1
     for J=rows:-1:1
       if(zps(I,J)==0)
          zps(I,J)=NaN;
          xps(I,J)=NaN;
          yps(I,J)=NaN;
       end
       if(zps(I+rows,J)==0)
          zps(I+rows,J)=NaN;
          xps(I+rows,J)=NaN;
          yps(I+rows,J)=NaN;
       end
    end
end
surfc(xps,yps,zps)
太感谢了
7楼2013-11-27 10:49:40
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jiangzi888

新虫 (初入文坛)

引用回帖:
6楼: Originally posted by dbb627 at 2013-11-26 22:19:32
不清楚,把程序贴出来看看吧...

笑脸那是冒号
8楼2013-11-27 10:51:22
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

ben_ladeng: 专家考核 2014-01-09 20:19:26
tx=Np(I,1)/2+51;
    ty=Np(I,2)/2+51;
    tz=Np(I,3);

Np没给出,怎么画。
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
9楼2013-11-27 17:26:07
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jiangzi888

新虫 (初入文坛)

引用回帖:
9楼: Originally posted by dbb627 at 2013-11-27 17:26:07
tx=Np(I,1)/2+51;
    ty=Np(I,2)/2+51;
    tz=Np(I,3);

Np没给出,怎么画。

NP给了啊,Np=points(1:i-1,:),您指的是?
10楼2013-11-28 15:16:14
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 jiangzi888 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 东南大学364求调剂 +4 JasonYuiui 2026-03-15 4/200 2026-03-16 08:36 by Linda Hu
[考研] 22408总分284求调剂 +3 InAspic 2026-03-13 3/150 2026-03-15 11:10 by zhq0425
[考研] 材料专硕326求调剂 +4 墨煜姒莘 2026-03-15 4/200 2026-03-15 11:02 by dyw
[考研] 309求调剂 +4 花与叶@ 2026-03-10 4/200 2026-03-14 21:26 by a不易
[考研] 材料与化工(0856)304求B区调剂 +7 邱gl 2026-03-10 11/550 2026-03-14 12:18 by 邱gl
[考研] 308 085701 四六级已过求调剂 +7 温乔乔乔乔 2026-03-12 14/700 2026-03-14 10:49 by JourneyLucky
[考研] 332分材料工程调剂 +3 莓好时光海苔 2026-03-09 3/150 2026-03-14 02:03 by JourneyLucky
[考研] 求调剂! +4 朔朔话 2026-03-09 4/200 2026-03-14 01:38 by JourneyLucky
[考研] 材料工程,326分,求调剂 +6 KRSLSR 2026-03-10 6/300 2026-03-13 23:47 by JourneyLucky
[考研] 工科,求调剂 +3 我887 2026-03-11 3/150 2026-03-13 21:39 by JourneyLucky
[考研] 求调剂 +5 一定有学上- 2026-03-12 5/250 2026-03-13 18:31 by ms629
[考研] 材料专硕350 求调剂 +4 王金科 2026-03-12 4/200 2026-03-13 16:02 by ruiyingmiao
[考研] 土木第一志愿276求调剂,科研和技能十分丰富,求新兴方向的导师收留 +3 土木小天才 2026-03-12 3/150 2026-03-13 15:01 by JourneyLucky
[考研] 328化工专硕求调剂 +4 。,。,。,。i 2026-03-12 4/200 2026-03-13 14:44 by JourneyLucky
[论文投稿] 投稿问题 5+4 星光灿烂xt 2026-03-12 6/300 2026-03-13 14:17 by god_tian
[考研] 0856化学工程280分求调剂 +4 shenzxsn 2026-03-11 4/200 2026-03-13 11:55 by ymwdoctor
[考研] 277求调剂 +4 anchor17 2026-03-12 4/200 2026-03-13 11:15 by 白夜悠长
[考研] 070303一志愿西北大学学硕310找调剂 +3 d如愿上岸 2026-03-13 3/150 2026-03-13 10:43 by houyaoxu
[考研] 求调剂材料专硕293 +6 段_(:з」∠)_ 2026-03-10 6/300 2026-03-10 18:22 by ms629
[考研] 一志愿:武汉理工,材料工程,英二数二 总分314 +3 2202020125 2026-03-10 4/200 2026-03-10 13:54 by xiongyaxuan
信息提示
请填处理意见