| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4915 人关注过本帖
标题:三次样条插值的代码, 求高手帮助~
只看楼主 加入收藏
茵梦湖
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:31
帖 子:545
专家分:2180
注 册:2009-4-25
结帖率:100%
收藏
 问题点数:0 回复次数:5 
三次样条插值的代码, 求高手帮助~

求 三次样条插值的 vfp代码~  如, 求b=67.34759时, 对应的 a插值( 是三次样条插值, 不是拉格朗日或分段等其它插值; 不要用到matlab的函数 )~  不胜感谢~

    a           b
  ===        =========
  0.5        18.453112
    1        26.708874
  1.5        33.719939
    2        40.313374
  2.5        46.442608
    3        52.513034
    4        64.200686
    5        75.733463
    6        87.259722
    7        98.840930
    8       110.455645
    9       122.262716
   10       134.314002
   11       146.523455
   12       159.029723
   13       171.733376
   14       184.845683
   15       198.282892
   16       211.876066
   17       225.987211
   18       240.518311
   19       255.159935
   20       270.492911
   21       285.997688
   22       302.161308

 

附: 网上下载的三次样条插值的 FORTRAN/vb 源代码

三次样条插值的FORTRAN源代码

C SPLINE3(N1,T1,X1,N2,T2,X2,D1,D2,C)
C ROLE  : CALCULATE INTERPOLATION,DIFFERENTIAL(ONE DEGREE AND TWO DEGREE),CALCULUS
C METHOD: THREE SPLINE INTERPOLATION
C INPUT : N1,T1(N1),X1(N1)=NUMBER OF X1, TIME INDEX OF X1, ORIGINAL DATA
C INPUT : N2,T2(N2)=NUMBER OF X2, TIME INDEX OF X2
C OUTPUT: X2(N2)=INTERPOLATION DATA AT TIME T2 FROM X1(N1)
C OUTPUT: D1(N2),D2(N2),C(N2)=ONE DEGREE DIFFENTIAL,TWO DEGREE DIFFENTIAL,CALCULUS OF VECTOR X2
C INTEGER: N1,N2
C REAL*8 : T1,X1,T2,X2,D1,D2,C
c n = the number of the data samples
c m = the number of the  interpolation points you want to produce         
c x(n)= epochs of sample points
c y(n)= value of function at samples points
c t(m)= epochs of the interpolation points
c u(m)= values of function at interpolation points      
c uu= the first degree differential(dao suo)
c v = the second degree differential(dao shu)
c sum= calculus(ji fen)   
c a(n),b(n),c(n),d(n)= the working array         
c reference: 丁月蓉,天文数据处理(for interpolation and differential); 徐士良,FORTRAN常用算法程序集(for calculus)。
        subroutine spline3(n,x,y,M,t,u,uu,V,sum)
        implicit double precision (a-h,o-z)
        dimension x(n),y(n),t(m),u(m),a(n),b(n),c(n),d(n),uu(m),V(m)
        dimension sum(m)
  a(1)=0.0d0
        d(1)=0.0d0
        d(n)=0.0d0
        c(n)=0.0d0
        a(n)=1.0d0
        b(1)=1.0d0
        c(1)=-1.0d0
        b(n)=-1.0d0
        l=n-1
        do 5 i=2,l
        a(i)=(x(i)-x(i-1))/6.0d0
        c(i)=(x(i+1)-x(i))/6.0d0
        b(i)=2.0d0*(a(i)+c(I))
5       d(i)=(y(i+1)-y(i))/(x(i+1)-x(i))-(y(i)-y(i-1))/(x(i)-x(i-1))
        c(1)=c(1)/b(1)
        d(1)=d(1)/b(1)
        do 10 i=2,n
        c(i)=c(i)/(b(i)-a(i)*c(i-1))
10      d(i)=(d(i)-a(i)*d(i-1))/(b(i)-a(I)*c(i-1))
        a(n)=d(n)
      
  do 15 i=1,l
        j=n-i
15      a(j)=d(j)-c(j)*a(j+1)
      
  do 30 j1=1,m
        f=t(j1)
        do 20 j2=1,n-1
        if(x(j2).le.f.and.f.le.x(j2+1)) goto 25
20      continue
        goto 30
25      e=x(j2+1)-x(j2)
        rr=(a(j2)*(x(j2+1)-f)**3+a(j2+1)*(f-x(j2))**3)/6.0d0/e
        ss=(x(j2+1)-f)*(y(j2)/e-a(j2)*e/6.0d0)
        tt=(f-x(j2))*(y(j2+1)/e-a(j2+1)*e/6.0d0)
        aa=(a(j2+1)*(f-x(j2))**2)/2.0d0/e
        dd=(a(j2)*(x(j2+1)-f)**2)/2.0d0/e
        bb=(y(j2+1)-y(j2))/e
        cc=(a(j2+1)-a(j2))*e/6.0d0
        uu(j1)=aa+bb-cc-dd
        u(j1)=rr+ss+tt
        V(j1)=(a(j2)*(x(j2+1)-f)+a(j2+1)*(f-x(j2)))/e
30      continue
        DO 33 I=1,M
        do 33 j3=1,I-1
if(j3.ne.m) then
e=t(j3+1)-t(j3)
else
e=t(m)-t(m-1)
endif
        sum(I)=sum(I)+.5d0*e*(u(j3+1)+u(j3))-e**3*(V(j3)+V(j3+1))/24.0d0
33      CONTINUE
CPRINT *, U
        return
        end



vb三次样条插值函数绘图的源代码(绘图部分不需要, 只需 求插入值的代码即可)

Dim X(1000) As Single, Y(1000) As Single
Dim u1(0 To 80000) As Single, v1(0 To 80000) As Single
Dim num As Long
Dim t As Integer

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Dim de As Integer
Dim ToInit As Boolean
Dim DownX As Single, DownY As Single
Sub Drawposi(Index As Integer)
    Me.Picture1.ForeColor = 0
    Me.Picture1.Line (0, Y(Index))-(1024, Y(Index))
    Me.Picture1.Line (X(Index), 0)-(X(Index), 770)
End Sub

Function hypot(ByVal X As Single, ByVal Y As Single)
 hypot = Sqr(X ^ 2 + Y ^ 2)
End Function

Sub MovePic(Index As Integer)
    Dim i As Integer
    X(Index) = Picture2(Index).Left + 4
    Y(Index) = Picture2(Index).Top + 4
    lblX.Caption = "X: " + CStr(CInt(X(Index)))
    lblY.Caption = "Y: " + CStr(CInt(Y(Index)))
    lblX.Refresh
    lblY.Refresh
    Me.Picture1.Cls
    Me.Picture1.ForeColor = QBColor(10)
    For i = 0 To t - 1
        Me.Picture1.CurrentX = X(i) + 4
        Me.Picture1.CurrentY = Y(i) + 4
        Me.Picture1.Print i
    Next i
End Sub

Private Sub Command1_Click()
Dim i As Long
 'Picture1.Scale (0, 0)-(640, 550)
 DrawWidth = 3
 Picture1.Cls
 'If Check1.Value Then Command2_Click
 'X(0) = 1
 'Y(0) = 1
 'X(t - 1) = 638
 'Y(t - 1) = 548
 Picture1.ForeColor = QBColor(10)
 For i = 0 To t - 1
  Picture1.Line (X(i) - 1, Y(i) - 1)-(X(i) + 1, Y(i) + 1), QBColor(10), B
  Picture1.Print i
 Next i
 Picture1.ForeColor = QBColor(12)
 DrawWidth = 1
 tspLine t - 1, 2, 0, 0, 0, 0
 Picture1.PSet (u1(0), v1(0))
  For i = 1 To num - 1
   Picture1.Line -(u1(i), v1(i))
   'For de = 1 To 12000: Next de 'Sleep 1
  Next i
 Picture1.ForeColor = QBColor(10)
 For i = 0 To t - 1
  Picture1.Line (X(i) - 1, Y(i) - 1)-(X(i) + 1, Y(i) + 1), QBColor(10), B
  Picture1.Print i
 Next i
End Sub

Private Sub Command2_Click()
Dim i As Integer
 Randomize Timer
 ToInit = Not ToInit
 If ToInit Then
    = False
    = "结束初始化"
    Me.Cls
    For i = 1 To t - 1
        Load Me.Picture2(i)
    Next i
    For i = 0 To t - 1
        Picture2(i).Left = X(i) - 4
        Picture2(i).Top = Y(i) - 4
        Picture2(i).Visible = True
    Next i
    Picture1.Cls
    Me.Picture1.ForeColor = QBColor(10)
    For i = 0 To t - 1
        Picture1.Line (X(i) - 1, Y(i) - 1)-(X(i) + 1, Y(i) + 1), QBColor(10), B
        Picture1.Print i
    Next i
 Else
    = True
    = "开始初始化"
    For i = 1 To t - 1
        Unload Me.Picture2(i)
    Next i
    Me.Picture2(0).Visible = False
 End If
 
 Exit Sub
 For i = 0 To t
     X(i) = Rnd(1) * 500 + Rnd(1) * 50 + 12
     Y(i) = Rnd(1) * 400 + Rnd(1) * 100 + 12
     'X(i) = i * 20 + Rnd(1) * 10 + 12
     'Y(i) = i * 10 + Rnd(1) * 300 + 22 - Rnd(1) * 200
 Next i
End Sub
Sub tspLine(ByVal n As Integer, ByVal ch As Integer, ByVal tx1 As Single, ByVal tx2 As Single, ByVal ty1 As Single, ByVal ty2 As Single)
Dim a(1000) As Single, b(1000) As Single, c(1000) As Single, dX(1000) As Single, dY(1000) As Single
Dim qx(1000) As Single, qy(1000) As Single
Dim tt As Single, bx3 As Single, bx4 As Single, by3 As Single, by4 As Single
Dim cx As Single, cy As Single, t(1000) As Single, px(1000) As Single, py(1000) As Single
Dim u(3000) As Single, v(3000) As Single, i As Integer
num = 0
For i = 1 To n
 t(i) = hypot(X(i) - X(i - 1), Y(i) - Y(i - 1))
Next i
Select Case ch
 Case 0 '抛物条件
   u(0) = (X(1) - X(0)) / t(1): u(1) = (X(2) - X(1)) / t(2)
   u(2) = (u(1) - u(0)) / (t(2) + t(1))
   tx1 = u(0) - u(2) * t(1)
   u(0) = (Y(1) - Y(0)) / t(1): u(1) = (Y(2) - Y(1)) / t(2)
   u(2) = (u(1) - u(0)) / (t(2) + t(1))
   ty1 = u(0) - u(2) * t(1)
   u(0) = (X(n) - X(n - 1)) / t(n): u(1) = (X(n - 1) - X(n - 2)) / t(n - 1)
   u(2) = (u(0) - u(1)) / (t(n) + t(n - 1))
   tx2 = u(0) + u(2) * t(n)
   u(0) = (Y(n) - Y(n - 1)) / t(n): u(1) = (Y(n - 1) - Y(n - 2)) / t(n - 1)
   u(2) = (u(0) - u(1)) / (t(n) + t(n - 1))
   ty2 = u(0) + u(2) * t(n)
 Case 1 '夹持条件
  a(0) = 1: c(0) = 0: dX(0) = tx1: dY(0) = ty1
  a(n) = 1: b(n) = 0: dX(n) = tx2: dY(n) = ty2
 Case 2 '自由条件
  a(0) = 2: c(0) = 1
  dX(0) = 3 * (X(1) - X(0)) / t(1): dY(0) = 3 * (Y(1) - Y(0)) / t(1)
  a(n) = 2: b(n) = 1
  dX(n) = 3 * (X(n) - X(n - 1)) / t(n): dY(n) = 3 * (Y(n) - Y(n - 1)) / t(n)
 Case 3 '循环条件
  a(0) = 2: c(0) = 1
  dX(0) = 3 * (X(1) - X(0)) / t(1) - (t(1) * (X(2) - X(1)) / t(2) - X(1) + X(0)) / (t(1) + t(2))
  dY(0) = 3 * (Y(1) - Y(0)) / t(1) - (t(1) * (Y(2) - Y(1)) / t(2) - Y(1) + Y(0)) / (t(1) + t(2))
  a(n) = 2: b(n) = 1
  dX(n) = 3 * (X(n) - X(n - 1)) / t(n)
  dX(n) = dX(n) + (X(n) - X(n - 1) - t(n) * (X(n - 1) - X(n - 2)) / t(n - 1)) / (t(n) + t(n - 1))
  dY(n) = 3 * (Y(n) - Y(n - 1)) / t(n)
  dY(n) = dY(n) + (Y(n) - Y(n - 1) - t(n) * (Y(n - 1) - Y(n - 2)) / t(n - 1)) / (t(n) + t(n - 1))
End Select

'计算方程组系数阵和常数阵
For i = 1 To n - 1
 a(i) = 2 * (t(i) + t(i + 1)): b(i) = t(i + 1): c(i) = t(i)
 dX(i) = 3 * (t(i) * (X(i + 1) - X(i)) / t(i + 1) + t(i + 1) * (X(i) - X(i - 1)) / t(i))
 dY(i) = 3 * (t(i) * (Y(i + 1) - Y(i)) / t(i + 1) + t(i + 1) * (Y(i) - Y(i - 1)) / t(i))
Next i

'采用追赶法解方程组
c(0) = c(0) / a(0)
For i = 1 To n - 1
 a(i) = a(i) - b(i) * c(i - 1): c(i) = c(i) / a(i)
Next i
a(n) = a(n) - b(n) * c(i - 1)
qx(0) = dX(0) / a(0): qy(0) = dY(0) / a(0)
For i = 1 To n
  qx(i) = (dX(i) - b(i) * qx(i - 1)) / a(i)
  qy(i) = (dY(i) - b(i) * qy(i - 1)) / a(i)
Next i
px(n) = qx(n): py(n) = qy(n)
For i = n - 1 To 0 Step -1
 px(i) = qx(i) - c(i) * px(i + 1)
 py(i) = qy(i) - c(i) * py(i + 1)
Next i
'计算曲线上点的坐标
For i = 0 To n - 1
 bx3 = (3 * (X(i + 1) - X(i)) / t(i + 1) - 2 * px(i) - px(i + 1)) / t(i + 1)
 bx4 = ((2 * (X(i) - X(i + 1)) / t(i + 1) + px(i) + px(i + 1)) / t(i + 1)) / t(i + 1)
 by3 = (3 * (Y(i + 1) - Y(i)) / t(i + 1) - 2 * py(i) - py(i + 1)) / t(i + 1)
 by4 = ((2 * (Y(i) - Y(i + 1)) / t(i + 1) + py(i) + py(i + 1)) / t(i + 1)) / t(i + 1)
 tt = 0
 While (tt <= t(i + 1))
  cx = X(i) + (px(i) + (bx3 + bx4 * tt) * tt) * tt
  cy = Y(i) + (py(i) + (by3 + by4 * tt) * tt) * tt
  u1(num) = cx: v1(num) = cy: num = num + 1: tt = tt + 0.5
 Wend
 u1(num) = X(i + 1): v1(num) = Y(i + 1): num = num + 1
Next i
End Sub

Private Sub Form_Load()
Dim i As Integer
t = 30
ToInit = False
 'Picture1.Scale (0, 0)-(640, 550)

 Randomize Timer
  = "开始初始化"
 For i = 0 To t
     X(i) = Rnd(1) * 500 + Rnd(1) * 50 + 12
     Y(i) = Rnd(1) * 400 + Rnd(1) * 100 + 12
 Next i

 For i = 0 To t
     X(i) = i * 30 + 20
     Y(i) = i * 20 + 20
 Next i
'Me.Picture1.Picture = LoadPicture("c:\my documents\MenuBack.bmp")
Me.Picture1.BackColor = QBColor(0)
End Sub

Private Sub Form_Resize()
            On Error Resume Next
            Me.Picture1.Height = Me.ScaleHeight - 40
End Sub


Private Sub Form_Unload(Cancel As Integer)
            End
End Sub


Private Sub Picture2_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
            On Error Resume Next
            If Button = 1 Then
               DownX = X
               DownY = Y
               Picture2(Index).ZOrder 0
               Picture2(Index - 1).BackColor = QBColor(12)
               Picture2(Index + 1).BackColor = QBColor(12)
               lblX.Caption = "X: " + CStr(CInt(Picture2(Index).Left + 4))
               lblY.Caption = "Y: " + CStr(CInt(Picture2(Index).Top + 4))
               lblX.Refresh
               lblY.Refresh
               MovePic Index
               Drawposi Index
            End If
End Sub

Private Sub Picture2_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
            If Button = 1 Then
               Picture2(Index).Left = Picture2(Index).Left - DownX + X
               Picture2(Index).Top = Picture2(Index).Top - DownY + Y
               MovePic Index
               Command1_Click
               Drawposi Index
            End If
End Sub


Private Sub Picture2_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
            On Error Resume Next
            If Button = 1 Then
               DownX = X
               DownY = Y
               Picture2(Index - 1).BackColor = QBColor(15)
               Picture2(Index + 1).BackColor = QBColor(15)
               'MovePic Index
               lblX.Caption = "X:"
               lblY.Caption = "Y:"
               lblX.Refresh
               lblY.Refresh
               Command1_Click
            End If
End Sub


[ 本帖最后由 茵梦湖 于 2010-6-4 17:18 编辑 ]
搜索更多相关主题的帖子: 样条插值 代码 
2010-06-03 16:16
茵梦湖
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:31
帖 子:545
专家分:2180
注 册:2009-4-25
收藏
得分:0 

这是根据 徐士良程序集的fortran语言改编的, 但总觉得不对, 奇怪了~

proc ESPL2
para X,Y,N,DY1,DYN,XX,M,DY,DDY,S,DS,DDS,T,H
DIME X(N),Y(N),XX(M),DY(N),DDY(N)
DIME S(M),DS(M),DDS(M),H(N)
*DOUBLE PRECISION X,Y,XX,DY,DDY,S,DS,DDS,H,DY1,DYN,
     *                   T,H0,H1,BETA,ALPHA

DY(1)=-0.5
H0=X(2)-X(1)
H(1)=3.0*(Y(2)-Y(1))/(2.0*H0)-DY1*H0/4.0
for J=2 to N-1
  H1=X(J+1)-X(J)
  ALPHA=H0/(H0+H1)
  BETA=(1.0-ALPHA)*(Y(J)-Y(J-1))/H0
  BETA=3.0*(BETA+ALPHA*(Y(J+1)-Y(J))/H1)
  DY(J)=-ALPHA/(2.0+(1.0-ALPHA)*DY(J-1))
  H(J)=(BETA-(1.0-ALPHA)*H(J-1))
  H(J)=H(J)/(2.0+(1.0-ALPHA)*DY(J-1))
  H0=H1
endfor
DY(N)=(3.0*(Y(N)-Y(N-1))/H1+DYN*H1/2.0-H(N-1))/(2.0+DY(N-1))
for J=N-1 to 1 step -1
    DY(J)=DY(J)*DY(J+1)+H(J)
endfor
for J=1 to N-1
    H(J)=X(J+1)-X(J)
endfor
for J=1 to N-1
  H1=H(J)*H(J)
  DDY(J)=6.0*(Y(J+1)-Y(J))/H1 -2.0*(2.0*DY(J)+DY(J+1))/H(J)
endfor
H1=H(N-1)*H(N-1)
DDY(N)=6.0*(Y(N-1)-Y(N))/H1 +2.0*(2.0*DY(N)+DY(N-1))/H(N-1)
T=0.0
for I=1 to N-1
  H1=0.5*H(I)*(Y(I)+Y(I+1))
  H1=H1-H(I)*H(I)*H(I)*(DDY(I)+DDY(I+1))/24.0
  T=T+H1
endfor
for J=1 to M
  IF XX(J)>=X(N)
     I=N-1
  ELSE
    I=1
    do whil XX(J)>X(I+1)
       I=I+1
    enddo
  ENDIF
  H1=(X(I+1)-XX(J))/H(I)
  S(J)=(3.0*H1*H1-2.0*H1*H1*H1)*Y(I)
  S(J)=S(J)+H(I)*(H1*H1-H1*H1*H1)*DY(I)
  DS(J)=6.0*(H1*H1-H1)*Y(I)/H(I)
  DS(J)=DS(J)+(3.0*H1*H1-2.0*H1)*DY(I)
  DDS(J)=(6.0-12.0*H1)*Y(I)/(H(I)*H(I))
  DDS(J)=DDS(J)+(2.0-6.0*H1)*DY(I)/H(I)
  H1=(XX(J)-X(I))/H(I)
  S(J)=S(J)+(3.0*H1*H1-2.0*H1*H1*H1)*Y(I+1)
  S(J)=S(J)-H(I)*(H1*H1-H1*H1*H1)*DY(I+1)
  DS(J)=DS(J)-6.0*(H1*H1-H1)*Y(I+1)/H(I)
  DS(J)=DS(J)+(3.0*H1*H1-2.0*H1)*DY(I+1)
  DDS(J)=DDS(J)+(6.0-12.0*H1)*Y(I+1)/(H(I)*H(I))
  DDS(J)=DDS(J)-(2.0-6.0*H1)*DY(I+1)/H(I)
endfor
RETURN




徐士良fortran源程序

SUBROUTINE ESPL2(X,Y,N,DY1,DYN,XX,M,DY,DDY,S,DS,DDS,T,H)
DIMENSION X(N),Y(N),XX(M),DY(N),DDY(N)
        DIMENSION S(M),DS(M),DDS(M),H(N)
DOUBLE PRECISION X,Y,XX,DY,DDY,S,DS,DDS,H,DY1,DYN,
     *                   T,H0,H1,BETA,ALPHA
DY(1)=-0.5
H0=X(2)-X(1)
H(1)=3.0*(Y(2)-Y(1))/(2.0*H0)-DY1*H0/4.0
DO 10 J=2,N-1
  H1=X(J+1)-X(J)
  ALPHA=H0/(H0+H1)
  BETA=(1.0-ALPHA)*(Y(J)-Y(J-1))/H0
  BETA=3.0*(BETA+ALPHA*(Y(J+1)-Y(J))/H1)
  DY(J)=-ALPHA/(2.0+(1.0-ALPHA)*DY(J-1))
  H(J)=(BETA-(1.0-ALPHA)*H(J-1))
  H(J)=H(J)/(2.0+(1.0-ALPHA)*DY(J-1))
  H0=H1
10CONTINUE
DY(N)=(3.0*(Y(N)-Y(N-1))/H1+DYN*H1/2.0-H(N-1))
     *         /(2.0+DY(N-1))
DO 20 J=N-1,1,-1
20DY(J)=DY(J)*DY(J+1)+H(J)
DO 30 J=1,N-1
30H(J)=X(J+1)-X(J)
DO 40 J=1,N-1
  H1=H(J)*H(J)
  DDY(J)=6.0*(Y(J+1)-Y(J))/H1-
     *           2.0*(2.0*DY(J)+DY(J+1))/H(J)
40CONTINUE
H1=H(N-1)*H(N-1)
DDY(N)=6.0*(Y(N-1)-Y(N))/H1+
     *            2.0*(2.0*DY(N)+DY(N-1))/H(N-1)
T=0.0
DO 50 I=1,N-1
  H1=0.5*H(I)*(Y(I)+Y(I+1))
  H1=H1-H(I)*H(I)*H(I)*(DDY(I)+DDY(I+1))/24.0
  T=T+H1
50CONTINUE
DO 70 J=1,M
  IF (XX(J).GE.X(N)) THEN
    I=N-1
  ELSE
    I=1
60    IF (XX(J).GT.X(I+1)) THEN
      I=I+1
      GOTO 60
    END IF
  END IF
  H1=(X(I+1)-XX(J))/H(I)
  S(J)=(3.0*H1*H1-2.0*H1*H1*H1)*Y(I)
  S(J)=S(J)+H(I)*(H1*H1-H1*H1*H1)*DY(I)
  DS(J)=6.0*(H1*H1-H1)*Y(I)/H(I)
  DS(J)=DS(J)+(3.0*H1*H1-2.0*H1)*DY(I)
  DDS(J)=(6.0-12.0*H1)*Y(I)/(H(I)*H(I))
  DDS(J)=DDS(J)+(2.0-6.0*H1)*DY(I)/H(I)
  H1=(XX(J)-X(I))/H(I)
  S(J)=S(J)+(3.0*H1*H1-2.0*H1*H1*H1)*Y(I+1)
  S(J)=S(J)-H(I)*(H1*H1-H1*H1*H1)*DY(I+1)
  DS(J)=DS(J)-6.0*(H1*H1-H1)*Y(I+1)/H(I)
  DS(J)=DS(J)+(3.0*H1*H1-2.0*H1)*DY(I+1)
  DDS(J)=DDS(J)+(6.0-12.0*H1)*Y(I+1)/(H(I)*H(I))
  DDS(J)=DDS(J)-(2.0-6.0*H1)*DY(I+1)/H(I)
70CONTINUE
RETURN
END



2010-06-03 19:27
茵梦湖
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:31
帖 子:545
专家分:2180
注 册:2009-4-25
收藏
得分:0 

已结贴~
2010-06-05 01:09
Tiger5392
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:88
帖 子:2775
专家分:2237
注 册:2006-5-17
收藏
得分:0 
楼主也求助啦?弄一个三次样条插值原理看看就完了

感言:学以致用。 博客:http://www./blog/user14/65009/index.shtml email:Tiger5392@
2010-06-11 23:24
qingfameng
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:35
帖 子:964
专家分:3019
注 册:2010-2-6
收藏
得分:0 
个人看法:还是使用拉格朗日插值算法、以及二阶龙格-库塔方法,较为简单,可以套用固定公式进行数值模拟计算,速度快一点。再就是,VB 的优势,数值计算,图形动态模拟是优势,特别对于积分方程方面的数值求解的操作,与VF的偏重不大一样。
2010-06-12 00:49
茵梦湖
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:31
帖 子:545
专家分:2180
注 册:2009-4-25
收藏
得分:0 

感谢楼上2位的指点~
 
2010-06-12 11:52
快速回复:三次样条插值的代码, 求高手帮助~
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033247 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved