声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2355|回复: 6

[绘图技巧] plot3画图的问题

[复制链接]
发表于 2009-3-27 06:08 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
错误提示::??? Subscript indices must either be real positive integers or logicals.   
这个错误提示是什么意思啊?
我就用plot3画个图。直接画没问题,我把向量传到一个函数里面后,在函数里面画就出来这个错误提示。

程序在下面
function createfig_ttv(y1, y2, y3)
%  Auto-generated by MATLAB on 26-Mar-2009 16:27:05
figure1 = figure;
axes1 = axes( 'Position',[0.13 0.5488 0.334 0.3762],  'XGrid','on',  'YGrid','on',  'Parent',figure1); box('on'); hold('all');
plot1 = plot(  y1,y2,  'LineStyle','none',  'Marker','.',  'MarkerSize',5,  'Parent',axes1); xlabel('Throttle'); ylabel('Thrust');
axes2 = axes(  'Position',[0.5703 0.5425 0.3277 0.3825],  'XGrid','on',  'YGrid','on',  'Parent',figure1);
box('on'); hold('all'); title('Piccolo 1027 Thu Dec 20 13-01-58 2007.log');
plot2 = plot(  y1,y3,  'LineStyle','none',  'Marker','*',  'MarkerSize',4,  'Parent',axes2); xlabel('Throttle'); ylabel('V');
axes3 = axes(  'Position',[0.13 0.11 0.3347 0.3412],  'XGrid','on',  'YGrid','on',  'Parent',figure1); box('on'); hold('all');
plot3 = plot(  y2,y3,  'LineStyle','none',  'Marker','*',  'MarkerSize',4,  'Parent',axes3); xlabel('Thrust'); ylabel('V');
axes4 = axes('Position',[0.5703 0.11 0.3347 0.3412],'Parent',figure1);
view([-46 26]); grid('on'); hold('all'); xlabel('Throttle'); ylabel('Thrust'); zlabel('V','Rotation',90);
plot4 = plot3(y1, y2,y3, 'Color',[0 0 1], 'LineStyle','none', 'Marker','.', 'Parent',axes4, 'ZDataSource','V');

就是红色的这块出错了。

对了
数据里,比如y1的前两个量是NaN。是不是这个导致的?
但是我在command window里用plot3画图就没有问题啊

[ 本帖最后由 ChaChing 于 2010-8-9 23:39 编辑 ]
回复
分享到:

使用道具 举报

发表于 2009-3-27 08:17 | 显示全部楼层
这个是许多初学者常犯的错误之一! 不难很基本但很重要!
先让大家练习看看
 楼主| 发表于 2009-3-27 09:39 | 显示全部楼层
老大别闹了,我都急死了。
发表于 2009-3-27 10:37 | 显示全部楼层

回复 地板 2365215 的帖子

把plot3 = plot(...改成p3 = plot……,不要用matlab的关键字作为变量名

评分

1

查看全部评分

 楼主| 发表于 2009-3-27 13:05 | 显示全部楼层
哦, 真没注意到。

赶紧回去改,谢谢了。
发表于 2009-3-27 14:06 | 显示全部楼层
 楼主| 发表于 2009-3-27 14:46 | 显示全部楼层
这程序是matlab自己生成的。
看来matlab也不完全可信啊

别sorry,我可不敢当,不过真感谢各位啊。

[ 本帖最后由 ChaChing 于 2009-3-27 15:20 编辑 ]
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-3 17:28 , Processed in 0.055935 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表