Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
50
Task/Deconvolution-1D/FreeBASIC/deconvolution-1d.basic
Normal file
50
Task/Deconvolution-1D/FreeBASIC/deconvolution-1d.basic
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
Sub Deconv(g() As Double, f() As Double, h() As Double)
|
||||
Dim As Integer n, i, lower
|
||||
Dim As Integer hCount = Ubound(g) - Ubound(f) + 2
|
||||
Redim h(hCount - 1)
|
||||
|
||||
For n = 0 To hCount - 1
|
||||
h(n) = g(n)
|
||||
lower = Iif(n >= Ubound(f) + 1, n - Ubound(f), 0)
|
||||
i = lower
|
||||
While i < n
|
||||
h(n) -= h(i) * f(n - i)
|
||||
i += 1
|
||||
Wend
|
||||
h(n) /= f(0)
|
||||
Next n
|
||||
End Sub
|
||||
|
||||
Dim As Integer i
|
||||
Dim As Double h(5) = {-8, -9, -3, -1, -6, 7}
|
||||
Dim As Double f(15) = {-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1}
|
||||
Dim As Double g(20) = {24, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, 25, -67, -96, 96, 31, 55, 36, 29, -43, -7}
|
||||
Dim As Double result()
|
||||
|
||||
Print !"h:\n[";
|
||||
For i = Lbound(h) To Ubound(h)
|
||||
Print h(i); ",";
|
||||
Next i
|
||||
Print Chr(8) & !"]\n";
|
||||
|
||||
Deconv(g(), f(), result())
|
||||
Print !"\deconv(g, f):\n[";
|
||||
For i = Lbound(result) To Ubound(result)-1
|
||||
Print result(i); ",";
|
||||
Next i
|
||||
Print Chr(8) & !"]\n";
|
||||
|
||||
Print
|
||||
Print !"f:\n[";
|
||||
For i = Lbound(f) To Ubound(f)
|
||||
Print f(i); ",";
|
||||
Next i
|
||||
Print Chr(8) & !"]\n";
|
||||
|
||||
Deconv(g(), h(), result())
|
||||
Print !"\deconv(g, h):\n[";
|
||||
For i = Lbound(result) To Ubound(result)-1
|
||||
Print Using "##_,"; result(i);
|
||||
Next i
|
||||
Print Chr(8) & !"]\n";
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue