Xi(k)=w1(k)f1(i)+w2(k)f2(i)+w3(k)f3(i)
ei(k)=Xi(k)-X(i)
wj(k)=wj(k)+nei(k)*fj(i)
n=1-k/M
其中M=500,i=1...12;j=1,2,3;
以上这个这样编程对不对,请指点一下:
Dim value_w(2) As Double
Dim value_f0(11) As Double
Dim value_f1(11) As Double
Dim value_f2(11) As Double
Dim value_X(11) As Double
Dim value_Xest(m_lengthsecond - 1) As Double
Dim value_E(m_lengthsecond - 1) As Double
Dim i, k As Integer
Dim sum As Double
value_f0(0) = 1455
value_f0(1) = 1546.08
value_f0(2) = 1553.48
value_f0(3) = 1560.91
value_f0(4) = 1568.37
value_f0(5) = 1575.87
value_f0(6) = 1583.41
value_f0(7) = 1590.98
value_f0(8) = 1598.59
value_f0(9) = 1606.24
value_f0(10) = 1613.92
value_f0(11) = 1621.64
value_f1(0) = 1479.2
value_f1(1) = 1509.01
value_f1(2) = 1520.91
value_f1(3) = 1532.9
value_f1(4) = 1544.99
value_f1(5) = 1557.17
value_f1(6) = 1569.45
value_f1(7) = 1581.82
value_f1(8) = 1594.29
value_f1(9) = 1606.86
value_f1(10) = 1619.53
value_f1(11) = 1632.3
value_f2(0) = 1455
value_f2(1) = 1490.5
value_f2(2) = 1518.33
value_f2(3) = 1527
value_f2(4) = 1534
value_f2(5) = 1543
value_f2(6) = 1550.38
value_f2(7) = 1557
value_f2(8) = 1560.33
value_f2(9) = 1563.9
value_f2(10) = 1568.27
value_f2(11) = 1571.16
value_X(0) = 1455
value_X(1) = 1526
value_X(2) = 1574
value_X(3) = 1553
value_X(4) = 1562
value_X(5) = 1588
value_X(6) = 1549
value_X(7) = 1604
value_X(8) = 1587
value_X(9) = 1596
value_X(10) = 1612
value_X(11) = 1603
Do
k = 1
For i = 0 To m_lengthsecond - 1
sum = 0
value_w(0) = 0.2
value_w(1) = 0.1
value_w(2) = 0.7
value_Xest(i) = value_f0(i) * value_w(0) + value_f1(i) * value_w(1) + value_f2(i) * value_w(2)
value_E(i) = value_X(i) - value_Xest(i)
value_w(0) = value_w(0) + (1 - k / m_valueM) * value_E(i) * value_f0(i)
value_w(1) = value_w(1) + (1 - k / m_valueM) * value_E(i) * value_f1(i)
value_w(2) = value_w(2) + (1 - k / m_valueM) * value_E(i) * value_f2(i)
sum = sum + (value_E(i)) ^ 2
k = k + 1
Loop Until sum < 0.0001
For i = 0 To 11
Text2(i).Text = Int(value_Xest(i) * 100) / 100
Next i
End Sub
[此贴子已经被作者于2007-7-9 8:46:36编辑过]