matlab中regress怎么用不对?>> x1=[66.290 40.964 72.996 45.010 57.204 26.852 38.122 35.840 75.796]x1 =66.2900 40.9640 72.9960 45.0100 57.2040 26.8520 38.1220 35.8400 75.7960>> y=[196 63 252 84 126 14 49 49 266]y =196 63 252 84 126 14 49 49 266>>
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/07 21:10:45
matlab中regress怎么用不对?>> x1=[66.290 40.964 72.996 45.010 57.204 26.852 38.122 35.840 75.796]x1 =66.2900 40.9640 72.9960 45.0100 57.2040 26.8520 38.1220 35.8400 75.7960>> y=[196 63 252 84 126 14 49 49 266]y =196 63 252 84 126 14 49 49 266>>
matlab中regress怎么用不对?
>> x1=[66.290 40.964 72.996 45.010 57.204 26.852 38.122 35.840 75.796]
x1 =
66.2900 40.9640 72.9960 45.0100 57.2040 26.8520 38.1220 35.8400 75.7960
>> y=[196 63 252 84 126 14 49 49 266]
y =
196 63 252 84 126 14 49 49 266
>> [b,bint,r,rint,stats]=regress(y,x1)
Error using ==> regress
The number of rows in Y must equal the number of rows in X.
请问出现这个问题为什么?
matlab中regress怎么用不对?>> x1=[66.290 40.964 72.996 45.010 57.204 26.852 38.122 35.840 75.796]x1 =66.2900 40.9640 72.9960 45.0100 57.2040 26.8520 38.1220 35.8400 75.7960>> y=[196 63 252 84 126 14 49 49 266]y =196 63 252 84 126 14 49 49 266>>
看一下regress的帮助文件:B = REGRESS(Y,X) returns the vector B of regression coefficients in thelinear model Y = X*B.
X is an n-by-p design matrix,with rowscorresponding to observations and columns to predictor variables.
Y isan n-by-1 vector of response observations.
它要求X是n*p阶矩阵,而Y为n*1向量,你的应该改成regress(y',x1') .