请高手帮忙看看这个Matlab程序哪里有错误

2024-12-21 17:18:36
推荐回答(2个)
回答1:

这次看看:

Y=[19.5,18,20.5,35.2,23.3,26.4,25.6,20.9,36.5,22.5]'
X1=[100, 0, 0, 50, 0, 50, 66.67, 16.67, 16.67, 33.3]';
X2=[0, 100, 0, 50, 50, 0, 16.67, 66.67, 16.67, 33.3]';
X3=[0, 0, 100, 0, 50, 50, 16.67, 16.67, 66.67, 33.3]';
X=[ones(length(Y),1) X1 X2 X3 X1.*X2 X1.*X3 X2.*X3 X1.^2 X2.^2 X3.^2]
[b, bcl, e, ecl, stat]=regress(Y, X, 0.05)
[B,BINT,R,RINT,STATS] =REGRESS(Y,X,0.05)
%the vector B of regression coefficients in the linear model Y = X*B. X is
%an n-by-p design matrix, with rows corresponding to observations and columns to predictor variables. Y is an n-by-1 vector of response observations.
%a matrix BINT of 95% confidence intervals for B.
%a vector R of residuals.
%a matrix RINT of intervals that can be used to diagnose outliers.
%a vector STATS containing, in the following order, the R-square statistic,
%the F statistic and p value for the full model, and an estimate of the error variance.
% a 100*(1-ALPHA)% confidence level to compute BINT, and a (100*ALPHA)% significance level to compute RINT.
lenb=length(b)
%{
disp('Regression coefficients and their confidence limits')
disp ( [ num2str ( bcl (:,1) ) repmat ( '<=beta( '), lenb , 1; num2str ( ( 0:lenb-1) ) repmat ( ')= '), lenb, 1; num2str ( b ) repmat ( '<='), lenb, 1; num2str ( bcl(:,2) ) ] )
disp ( [ 'Coefficient of determination R^2 =' num2str ( stat ( 1 ) ) ] )
disp ( ['Test statistic F0=',num2str ( stat ( 2 ) )' 'and corresponding p-value =' num2str ( stat ( 3 ) ) ] )
%}
normplot ( e )
whitebg ( 'white' )

回答2:

看不懂啊,这么复杂