break
end
end
e_b(k,j)=(ran_y-Kpr(t,2))/Kpr(t,1);
end
end
YE=mean(Ymodel,1);
for i=1:PLAN(1,2)
for j=1:4
YEB(i,j)=YE(j)+e_b(i,j);
end
end
YB=[Ymodel;YEB]
Результаты
k_int =
10
PLAN =
0 16.0000
2.7650 16.0000
7.2350 16.0000
10.0000 16.0000
random =
2.9361 -0.4815 1.8412 0.7282
0.7568 1.8548 -1.0443 -0.0075
2.7968 -0.9469 0.0113 -0.4143
-0.5097 -3.4878 -1.1743 1.9147
-1.7097 -1.8475 0.8804 2.7951
-0.3167 1.5835 -0.3768 -0.7838
1.7854 -0.1698 0.7202 0.1551
-1.6743 0.5688 1.0022 -1.2115
0.9529 1.4163 -0.1175 1.0207
-0.9021 -3.1806 1.3338 -3.5469
0.8268 -0.9670 3.4639 1.4852
-1.6498 -1.0565 0.7870 0.3283
0.1290 -1.5272 -0.0177 0.3925
-3.0068 -0.2731 1.3697 1.8202
-0.7396 2.2815 0.0839 -0.4120
0.6931 -0.0577 -1.6606 -0.1997
Ymodel =
8.9361 -17.9077 11.2243 166.7282
6.7568 -15.5713 8.3389 165.9925
8.7968 -18.3731 9.3945 165.5857
5.4903 -20.9140 8.2088 167.9147
4.2903 -19.2736 10.2636 168.7951
5.6833 -15.8427 9.0064 165.2162
7.7854 -17.5960 10.1034 166.1551
4.3257 -16.8573 10.3854 164.7885
6.9529 -16.0099 9.2657 167.0207
5.0979 -20.6068 10.7169 162.4531
6.8268 -18.3932 12.8471 167.4852
4.3502 -18.4826 10.1701 166.3283
6.1290 -18.9534 9.3655 166.3925
2.9932 -17.6993 10.7529 167.8202
5.2604 -15.1446 9.4671 165.5880
6.6931 -17.4838 7.7226 165.8003
YB =
8.9361 -17.9077 11.2243 166.7282
6.7568 -15.5713 8.3389 165.9925
8.7968 -18.3731 9.3945 165.5857
5.4903 -20.9140 8.2088 167.9147
4.2903 -19.2736 10.2636 168.7951
5.6833 -15.8427 9.0064 165.2162
7.7854 -17.5960 10.1034 166.1551
4.3257 -16.8573 10.3854 164.7885
6.9529 -16.0099 9.2657 167.0207
5.0979 -20.6068 10.7169 162.4531
6.8268 -18.3932 12.8471 167.4852
4.3502 -18.4826 10.1701 166.3283
6.1290 -18.9534 9.3655 166.3925
2.9932 -17.6993 10.7529 167.8202
5.2604 -15.1446 9.4671 165.5880
6.6931 -17.4838 7.7226 165.8003
6.1445 -31.0154 10.8344 157.6390
-7.8376 -19.6083 160.6103 322.7612
-1.1370 -9.1727 162.6336 314.3125
16.8975 -16.2632 171.3493 153.7297
-15.7842 -20.1722 159.7877 168.5988
-11.8188 -13.2703 2.9652 144.4223
156.1328 -16.0792 -0.9139 150.0908
6.6809 -32.4693 168.9071 141.4665
163.3159 -9.9274 7.8842 320.5740
162.3640 -7.0341 -11.8988 172.7334
-4.6702 -44.0234 -13.3154 162.2437
160.6686 139.5004 -16.1890 175.4624
-2.3574 -9.5188 160.1253 156.3545
15.1796 -40.5166 167.6074 157.4264
167.2321 -17.5159 21.1709 166.1757
5.3481 -31.7843 -1.1065 162.0427
sigma =1.5;
Q=[6 -4 -3 0.5];
e=[];
e_b=[];
Fp=[];
k_int=5;
k_pro=100;
k_opit=10;
sq_m=[];
sum_sq=0;
sig_m=[];
PLAN=[
0 16;
2.765 16;
7.235 16;
10 16;
];
random=randn(16,4)*sigma;
Ymodel=zeros(16,4);
for opit=1:k_opit
for j=1:PLAN(1,2)
for i=1:4
Ymodel(j,i)=Q(1)+Q(2)*PLAN(i,1)+Q(3)*PLAN(i,1)^2+Q(4)*PLAN(i,1)^3+random(j,i);
end
end
for i=1:4
Y(i)=Q(1)+Q(2)*PLAN(i,1)+Q(3)*PLAN(i,1)^2+Q(4)*PLAN(i,1)^3;
end
for j=1:PLAN(1,2)
for i=1:4
e(j,i)=Ymodel(j,i)-Y(i);
end
end
QB=[0 0 0 0];
for i=1:k_pro
for j=1:PLAN(1,2)
for i=1:4
YmodelB(j,i)=Q(1)+Q(2)*PLAN(i,1)+Q(3)*PLAN(i,1)^2+Q(4)*PLAN(i,1)^3+random(j,i);
end
end
for j=1:PLAN(1,2)
for i=1:4
e_b(j,i)=YmodelB(j,i)-Y(i);
end
end
YE=mean(Ymodel,1);
for i=1:PLAN(1,2)
for j=1:4
YEB(i,j)=YE(j)+e_b(i,j);
end
end
YB=[Ymodel;YEB];
YBS=mean(YB,1);
k=0;
for j=1:PLAN(1,2)
for i=1:4
k=k+1;
elem_b(k)=e_b(j,i);
end
end
k=4;
n=4;
m=1;
X=zeros(1,m);
f=[1 X(1) X(1)^2 X(1)^3];
F1=ones(n,k);
for i=1:n
for j=1:m
X(j)=PLAN(i,j);
end
f=[1 X(1) X(1)^2 X(1)^3];
for j=1:k
F1(i,j)=f(j);
end
end
D_buf=[];
for i=1:4
sum=0;
for j=1:(PLAN(1,2)+PLAN(1,2))
sum=sum+(YBS(i)-YB(j,i))^2;
end
D_buf(i)=1/(PLAN(1,2)+PLAN(1,2))*(PLAN(1,2) + PLAN(1,2)-1)*sum;
end
D=diag(D_buf);
M=F1'*inv(D)*F1;
F=inv(M)*F1'*inv(D);
QB1=F*YBS';
QB=QB+QB1';
end
QB=(QB/k_pro)';
Qo=inv(F1'*F1)*F1'*YE';
sq=0;sq1=0;
for i=1:4
s=(Q(i)-Qo(i))^2;
sq=sq+s;
end
for i=1:4
s=(Q(i)-QB(i))^2;
sq1=sq1+s;
end
if sq>sq1
sum_sq=sum_sq+1;
end
sq_buf=[sq;sq1];
sq_m=[sq_m sq_buf];
sig_m=[sig_m sigma];
end
YB
Результаты
YB =
4.6559 -19.9470 11.3483 164.5641
6.2028 -18.2865 9.8738 167.9388
5.7914 -17.7049 8.3737 166.6614
4.2549 -17.4128 9.1592 167.9214
7.7756 -16.1707 5.7096 165.2534
5.9769 -18.5096 10.0931 164.3219
6.8043 -18.5084 9.5586 167.2115
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.