ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[¤À¨É] ¤º´¡

[¤À¨É] ¤º´¡

³Ìªñ¦³ÂIµL²á,·Q¨ì¥H«e¾Çªº¤@¨Ç¼Æ¼Æ¾Ç¨ç¼Æ
¨ä¤¤¦³¤@ºØ¥s¤º´¡,©Î³\¦³¨Ç¤H»{¬°,¤º´¡À³¸Ó«Ü²³æ§a
°ê¤¤¥Í´N·|¤F,¦ý¨º­Ó¬O½u©Ê¤º´¡
§Ú¦b³o¸Ì´£¨Ñ¤@ºØ¥s©Ô®æ®Ô¤é´¡­Èªk,
§Ú§âsin¨ç¼Æªº1,2,3,4,5«×ªº­È¦C¥X¦U¬°
1«×  0.0174524
2«×  0.0348994
3«×  0.0523359
4«×  0.0697564
5«×  0.0871557
   
°²³]«eÃD¬O,§Ú­Ì¨Ã¤£ª¾¹D³o5­Ó­È¬O sin ¨ç¼Æ­È, ¨º§Ú­n¨D 3.5«×ªº­È­n«ç»ò¿ì

§Ú¤£·Q¦b¥h°µ¼Æ¾ÇÃÒ©ú,§Ú­Ì¥u§â¥¦·í¦¨¬OÀ³¥Î
¤è«K§Ú­Ì°µ¥ô¦ó¦h¼ÆÂI¤¤ªº¤º´¡
¥H¤U´N¬Oµ{¦¡½X
  1. Option Explicit


  2. Public Sub Interpolation()
  3.    
  4.     Dim x(1 To 5) As Double
  5.     Dim y(1 To 5) As Double
  6.         
  7.     Dim i As Integer
  8.     Dim j As Integer
  9.    
  10.     Dim Ratio As Double
  11.     Dim X_Value As Double
  12.     Dim Y_Value As Double

  13.    
  14.     For i = 1 To UBound(x)
  15.         x(i) = i
  16.     Next i
  17.    
  18.     y(1) = 0.0174524
  19.     y(2) = 0.0348994
  20.     y(3) = 0.0523359
  21.     y(4) = 0.0697564
  22.     y(5) = 0.0871557
  23.    
  24.     X_Value = 3.5
  25.         
  26.     Y_Value = 0
  27.    
  28.    For i = 1 To UBound(x)
  29.    
  30.     Ratio = 1
  31.     For j = 1 To UBound(x)
  32.    
  33.        If i <> j Then
  34.       
  35.         Ratio = Ratio * (X_Value - x(j)) / (x(i) - x(j))
  36.       
  37.        End If
  38.         
  39.     Next j
  40.    
  41.     Y_Value = Y_Value + Ratio * y(i)
  42.    
  43.    
  44.     Next i
  45.    
  46.     MsgBox Y_Value

  47.    

  48. End Sub
½Æ»s¥N½X

TOP

³o®É§Ú­Ì±oª¾  ¨D±o  y_value ­È¬° 0.0610484820
¹ê»Ú¤W§Ú­Ì¥h«ö­pºâ¾÷¬°  sin3.5 ¬°  0.06104853
»~®t²v·¥¬°¤p,³o¬O§Ú­Ì¦b 1¨ì5«×ªº½d¬°¤º¨úªºÂI¬Û·íªº¦h
¦pªG§Ú­Ì¦b1«×©M5«×¤§¶¡¥u¦³2­Ó­È,¨º´N¬O½u©Ê¤º´¡3.5«×­È
¨º»~®t´N¬Û·í¤j¤F,´£¨Ñµ¹¦U¦ì°Ñ¦Ò

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤Hªº§Ö¼Ö¡D¤£¬O¦]¬°¥L¾Ö¦³±o¦h¡A¦Ó¬O¦]¬°¥L­p¸û±o¤Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD