Home > Software engineering >  Into the linear interpolation using vb
Into the linear interpolation using vb

Time:11-01

Have a text data below
The serial number number
1 10
2 30
5 40
6 70
8 80
I batch interpolation, such as the serial number step 0.1 will appear the corresponding digital
Such as
1 10
1.1...
1.2...
1.3...
1.4...
1.5 20
. .
2 30
And so on

CodePudding user response:

This should be a popular algorithm for
http://zhidao.baidu.com/question/48796419.html

CodePudding user response:

Interpolation between each two points

CodePudding user response:

Algorithm design problem, is only expressed in VB,
 
Dim strLine As String, strItem () As String
Dim oldItem0 As Currency, newItem0 As Currency
Dim oldItem1 As Currency, newItem1 As Currency
Dim step As Currency, As an Integer I

"C: \ 1. TXT" Open For Input As # 1
The Line Input # 1, strLine
The Do While InStr (strLine, Space (2))
StrLine=Replace (strLine, Space (2), Space (1))
Loop
StrItem=Split (strLine, Space (1))

OldItem0=Val (strItem (0))
OldItem1=Val (strItem (1))

Do Until EOF (1)
The Line Input # 1, strLine
The Do While InStr (strLine, Space (2))
StrLine=Replace (strLine, Space (2), Space (1))
Loop
StrItem=Split (strLine, Space (1))

NewItem0=Val (strItem (0))
NewItem1=Val (strItem (1))

Step=(newItem0 - oldItem0)/(newItem1 - oldItem1)

For I=0 To (newItem1 - oldItem1) - 1
The Debug. Print Format (oldItem0 + I * step, "# # #. 00"), oldItem1 + I
Next I

OldItem0=newItem0
OldItem1=newItem1
Loop
Close # 1
The Debug. Print Format (oldItem0, "# # #. 00"), oldItem1

Results:
10
 1.0011 1.05 
1.10 12
1.15 13
1.20 14
1.25 15
1.30 16
1.35 17
1.40 18
1.45 19
1.50 20
1.55 21
1.60 22
1.65 23
1.70 24
1.75 25
1.80 26
1.85 27
1.90 28
1.95 29
2.00 30
2.30 31
2.60 32
2.90 33
3.20 34
3.50 35
3.80 36
4.10 37
4.40 38
4.70 39
5.00 40
5.03 41
5.07 42
43
5.105.13 44
5.17 45
5.20 46
5.23 47
5.27 48
5.30 49
5.33 50
5.37 51
5.40 52
53
5.435.47 54
5.50 55
5.53 56
5.57 57
5.60 58
5.63 59
5.67 60
5.70 61
5.73 62
5.77 63
5.80 64
5.83 65
5.87 66
5.90 67
5.93 68
5.97 69
6.00 70
6.20 71
6.40 72
6.60 73
6.80 74
7.00 75
7.20 76
7.40 77
7.60 78
7.80 79
8.00 80

CodePudding user response:

Thank you code is hard I want number 3 floor change Numbers follow changes such as serial number step length is 0.1 changes followed

CodePudding user response:

Hey hey, I know the change of the story.

CodePudding user response:



Effect as shown
After surface preserved, you instead of rar files after decompression is engineering.
  • Related