求matlab大神看我的程序哪里错了额y=[100,70,60,30,20,10,10,0,0,60,40,30]’;x4=[5,10,15,5,10,15,5,10,15,5,10,15];x2=[0,0,0,0,0,0,15,15,15,20,20,20];x3=[1.5,2.5,3.5,0.5,1.5,1.3,1.2,1.5,1.2,0.9,0.7,0.9];x41=[1.75*pi,1.75*pi,1.75*pi,1.75*pi,1
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 11:47:58
求matlab大神看我的程序哪里错了额y=[100,70,60,30,20,10,10,0,0,60,40,30]’;x4=[5,10,15,5,10,15,5,10,15,5,10,15];x2=[0,0,0,0,0,0,15,15,15,20,20,20];x3=[1.5,2.5,3.5,0.5,1.5,1.3,1.2,1.5,1.2,0.9,0.7,0.9];x41=[1.75*pi,1.75*pi,1.75*pi,1.75*pi,1
求matlab大神看我的程序哪里错了额
y=[100,70,60,30,20,10,10,0,0,60,40,30]’;
x4=[5,10,15,5,10,15,5,10,15,5,10,15];
x2=[0,0,0,0,0,0,15,15,15,20,20,20];
x3=[1.5,2.5,3.5,0.5,1.5,1.3,1.2,1.5,1.2,0.9,0.7,0.9];
x41=[1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi];
x31=[0,0,0,0.5*pi,0.5*pi,0.5*pi,pi,pi,pi,1.5*pi,1.5*pi,1.5*pi];
x51=x31-x41
x32=x3.*x5
X=[ones(size(x4)),x2,x32,x4]
[b,bint,r,rint,stats]=regress(y,X)
每次都是最后一步说y和X的行数不相等··为毛不相等啊···该怎么写呀
求matlab大神看我的程序哪里错了额y=[100,70,60,30,20,10,10,0,0,60,40,30]’;x4=[5,10,15,5,10,15,5,10,15,5,10,15];x2=[0,0,0,0,0,0,15,15,15,20,20,20];x3=[1.5,2.5,3.5,0.5,1.5,1.3,1.2,1.5,1.2,0.9,0.7,0.9];x41=[1.75*pi,1.75*pi,1.75*pi,1.75*pi,1
除最后一行外,程序里还有两个低级错误:
1、第一行的转置符为中文字符;
2、倒数第三行x32=x3.*x5的x5疑应为x51.
修改建议:
y=[100,70,60,30,20,10,10,0,0,60,40,30]';x4=[5,10,15,5,10,15,5,10,15,5,10,15];
x2=[0,0,0,0,0,0,15,15,15,20,20,20];
x3=[1.5,2.5,3.5,0.5,1.5,1.3,1.2,1.5,1.2,0.9,0.7,0.9];
x41=[1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi,1.75*pi];
x31=[0,0,0,0.5*pi,0.5*pi,0.5*pi,pi,pi,pi,1.5*pi,1.5*pi,1.5*pi];
x51=x31-x41
x32=x3.*x51
X=[ones(size(x4))',x2',x32',x4'];
[b,bint,r,rint,stats]=regress(y,X)