Deconvolution/1D: Difference between revisions
Content deleted Content added
Added Kotlin |
mNo edit summary |
||
Line 594: | Line 594: | ||
f = [-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1] |
f = [-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1] |
||
deconv(g, h) = [-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1] |
deconv(g, h) = [-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1] |
||
</pre> |
|||
=={{header|Julia}}== |
|||
The deconv function for floating point data is built into Julia. |
|||
Integer inputs may need to be converted and copied to floating point to use deconv(). |
|||
<lang Julia> |
|||
h = [-8,-9,-3,-1,-6,7] |
|||
g = [24,75,71,-34,3,22,-45,23,245,25,52,25,-67,-96,96,31,55,36,29,-43,-7] |
|||
f = [-3,-6,-1,8,-6,3,-1,-9,-9,3,-2,5,2,-2,-7,-1] |
|||
hanswer = deconv(Array{Float64,1}(g), Array{Float64,1}(f)) |
|||
println("The deconvolution deconv(g,f) is $hanswer, which is the same as h = $h\n") |
|||
fanswer = deconv(Array{Float64,1}(g), Array{Float64,1}(h)) |
|||
println("The deconvolution deconv(g,h) is $fanswer, which is the same as f = $f\n") |
|||
{{output}} |
|||
<pre> |
|||
The deconvolution deconv(g,f) is [-8.0, -9.0, -3.0, -1.0, -6.0, 7.0], |
|||
which is the same as h = [-8, -9, -3, -1, -6, 7] |
|||
The deconvolution deconv(g,h) is [-3.0, -6.0, -1.0, 8.0, -6.0, 3.0, -1.0, -9.0, -9.0, 3.0, -2.0, 5.0, 2.0, -2.0, -7.0, -1.0], |
|||
which is the same as f = [-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1] |
|||
</pre> |
</pre> |
||