Subscript indices must either be real positive integers or logicals.clearclctic;gen=100;N=10;L=22;n=10;pm=0.1;fat=0.2;P=init(N,L);x1min=145,x1max=155;x2min=1,x2max=5;x1=145:0.001:155;x2=1:1:5;y1='1-(0.1076+(0.352.*x1+0.189.*x1.*x2)/15000)/(1.1076+(0.
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/23 21:52:47
Subscript indices must either be real positive integers or logicals.clearclctic;gen=100;N=10;L=22;n=10;pm=0.1;fat=0.2;P=init(N,L);x1min=145,x1max=155;x2min=1,x2max=5;x1=145:0.001:155;x2=1:1:5;y1='1-(0.1076+(0.352.*x1+0.189.*x1.*x2)/15000)/(1.1076+(0.
Subscript indices must either be real positive integers or logicals.
clear
clc
tic;
gen=100;N=10;L=22;n=10;pm=0.1;fat=0.2;
P=init(N,L);
x1min=145,x1max=155;
x2min=1,x2max=5;
x1=145:0.001:155;
x2=1:1:5;
y1='1-(0.1076+(0.352.*x1+0.189.*x1.*x2)/15000)/(1.1076+(0.352.*x1+0.189.*x1.*x2)/15000)';
y2='(3721.*pi+4262.4).*x1+4597.925.*pi.*x1.*x2+36348.576.*pi+341152';
y='y1+1/y2';
vfx1=[];vfx2=[];vmfit=[];
it=0;
while it
Subscript indices must either be real positive integers or logicals.clearclctic;gen=100;N=10;L=22;n=10;pm=0.1;fat=0.2;P=init(N,L);x1min=145,x1max=155;x2min=1,x2max=5;x1=145:0.001:155;x2=1:1:5;y1='1-(0.1076+(0.352.*x1+0.189.*x1.*x2)/15000)/(1.1076+(0.
Subscript indices must either be real positive integers or logicals
中文解释:下标索引必须是正整数类型或者逻辑类型
出错原因:在访问矩阵(包括向量、二维矩阵、多维数组,下同)的过程中,下标索引要么从 0 开始,要么出现了负数.注:matlab 的语法规定矩阵的索引从 1 开始,这与 C 等编程语言的习惯不一样.
解决办法:自己调试一下程序,把下标为 0 或者负数的地方修正.
你的程序我运行了,没有错误.能得到结果.
我的运行环境是Matlab 7.5.0(R2007b), WindowsXP SP3