Dim N As Integer
'数组长度
Dim X() As Double
Dim Y() As Double
N = 10 '自己根据实际情况得到N值,如果为定值,在定义的时候 直接把X(),Y()定义为定长数组
ReDim X(N) As Double
ReDim Y(N + 1) As Double
'... 'Y()
数组自己录入
'...'X(0) 自己根据情况设定
For i = 1 To N
X(i) = 0.25 * Y(i - 1) + 0.5 * Y(i) + 0.25 * Y(i + 1)
Next i