声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2261|回复: 3

[编程技巧] 求助一图多纵坐标的问题

[复制链接]
发表于 2007-5-18 10:55 | 显示全部楼层 |阅读模式

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

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

x
在做一图时将三条图线做在一个图内,三条图线拟合后用plotyyy函数,则出现:
x=[0.001993,0.001891,0.001763,0.001661,0.001533,0.001431,0.001342,0.001252,0.00115,0.001022,0.000894,0.000779,0.000664,0.000537,0.000396,0.000268,0.000166,0.0000767];
>> y=[4.516735,6.149388,8.261633,9.445306,10.70041,11.30245,12.58816,13.04735,13.96571,14.75143,15.27184,16.05755,16.40449,17.01673,18.13918,18.75143,19.05755,19.26163];
>> y2=[0.402,0.408,0.402,0.396,0.39,0.384,0.378,0.372,0.36,0.348,0.342,0.324,0.312,0.306,0.288,0.27,0.258,0.252];
>> y3=[0.219575,0.279443,0.355287,0.38844,0.412455,0.412971,0.438046,0.430591,0.437384,0.42482,0.391582,0.378725,0.342509,0.292593,0.244595,0.182705,0.120296,0.057452];
>> aa=polyfit(x,y,2);
>> z=polyval(x,aa);
>> aa2=polyfit(x,y2,2);
>> z2=polyval(x,aa2);
>> aa3=polyfit(x,y3,2);
>> z3=polyval(x,aa3);
>> plotyyy(x,z,x,z2,x,z3)
错误:
??? Error using ==> plot
Vectors must be the same lengths.
Error in ==> plotyy>fevalfun at 288
    h = feval(func,x,y);
Error in ==> plotyy at 61
[h1,ax(1)] = fevalfun(fun1,ax(1),x1,y1,caxspecified);
Error in ==> plotyyy at 25
[ax,hlines(1),hlines(2)] = plotyy(x1,y1,x2,y2);
请大家帮我分析一下,谢谢大家
回复
分享到:

使用道具 举报

发表于 2007-5-18 10:57 | 显示全部楼层
原帖由 catlancer 于 2007-5-18 10:55 发表
在做一图时将三条图线做在一个图内,三条图线拟合后用plotyyy函数,则出现:
x=[0.001993,0.001891,0.001763,0.001661,0.001533,0.001431,0.001342,0.001252,0.00115,0.001022,0.000894,0.000779,0.000664,0.0 ...


应该是 plotyy 命令,这种问题建议自己调试一下,保证画图的几个变量其大小相同
 楼主| 发表于 2007-5-18 11:17 | 显示全部楼层
是那个一图三个纵坐标的,plotyy是两个吧,变量大小没问题,因为没拟合时这样做就没问题,可是一拟合就不行了,不解
发表于 2007-5-18 11:34 | 显示全部楼层
原帖由 catlancer 于 2007-5-18 11:17 发表
是那个一图三个纵坐标的,plotyy是两个吧,变量大小没问题,因为没拟合时这样做就没问题,可是一拟合就不行了,不解



还是建议自己调试一下,如果错误这么容易看出来,估计每个编程软件都不需要实现“debug”了
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-11-19 04:38 , Processed in 0.062023 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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