logo search
Лекция_3(Интерполяция)

0 : Begin

{i:=1; while XX > X[i] do i:=i+1;}

j:=1; i:=N1;

While j < i-1 do if XX >= X[Trunc((i+j)/2)] then j:=Trunc((i+j)/2)

else i:=Trunc((i+j)/2);

j:=i-1; D:=X[i]-X[j]; H:=XX-X[j]; R:=X[i]-XX;

P:=D*D/6; YY:=(M[j]*R*R*R+M[i]*H*H*H)/6/D;

YY:=YY+((Y[j]-M[j]*P)*R+(Y[i]-M[i]*P)*H)/D;

end;

-1: begin

D:=X[2]-X[1]; YY:=-D*M[2]/6+(Y[2]-Y[1])/D;

YY:=YY*(XX-X[1])+Y[1];

end;

end; (* case *)

Interpolate:=YY;

end; (* Spline.Interpolate *)

procedure SplineInterpolate.Output;