DW检验MATLAB代码

clc, clear,close all
x11=[839 935 1050 1188 1336 1443 1380 1546 1662]';
x12=[ 902.78 1069.3 1132.8 1239. 21384.2 1541.5 1577.8 1752.7 1795.6]';
x21=[1035 1170 1335 1530 1738 1825 1761 2033 2331]';
x22=[1110.9 1356.7 1455.4 1549.7 1746.6 1962.1 2020.2 2316.1 2464.2]';
x31=[1391 1609 1988 393 2716 3200 2725 3192 3590]';
x32=[1415.3 1896.3 1920.1 2256 2637.2 3046.5 2966.9 3488.4 3490.2]';
e1=x12-x11;
e11=e1 (1:8,: );
e12=e1(2:9,: );
Dw1 = sum ( (e12-e11).^2) / sum (e12.^2)%DW检验
subplot (1,3,1)
plot (e11,e12,'+')
title('专科')
subplot (1,3,2)
e2=x22-x21;
e21=e2(1:8,: );
e22=e2(2: 9,: );
DW2 = sum ( (e22-e21).^2) / sum (e22.^2)%DW检验
plot(e21,e22,'+')
title ('本科')
subplot (1,3,3)
e3=x32-x31;
e31=e3 (1:8,: );
e32=e3 (2: 9,: );
Dw3 = sum ( (e32-e31).^2)/ sum (e32.^2)%DW检验
plot (e31,e32,'+')
title ('硕士')
hold on
t1=0; y1=-200:0.01 :400;plot (t1,y1,'r')
hold on
plot(y1,t1,'r')

运行结果:
Dw1 =

    1.9845
DW2 =

    0.3483
Dw3 =

    2.1411

图像如图:

DW检验MATLAB代码_第1张图片

你可能感兴趣的:(数学建模,matlab,开发语言,算法)