Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
27
Task/Deconvolution-1D/JavaScript/deconvolution-1d.js
Normal file
27
Task/Deconvolution-1D/JavaScript/deconvolution-1d.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
function deconv(g, f) {
|
||||
const h = new Array(g.length - f.length + 1);
|
||||
for (let n = 0; n < h.length; n++) {
|
||||
h[n] = g[n];
|
||||
const lower = Math.max(n - f.length + 1, 0);
|
||||
for (let i = lower; i < n; i++)
|
||||
h[n] -= h[i] * f[n - i];
|
||||
h[n] /= f[0];
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
function main() {
|
||||
const h = [-8, -9, -3, -1, -6, 7];
|
||||
const f = [-3, -6, -1, 8, -6, 3, -1, -9, -9, 3, -2, 5, 2, -2, -7, -1];
|
||||
const g = [24, 75, 71, -34, 3, 22, -45, 23, 245, 25, 52, 25, -67, -96,
|
||||
96, 31, 55, 36, 29, -43, -7];
|
||||
|
||||
let output = '';
|
||||
output += `h = ${JSON.stringify(h)}\n`;
|
||||
output += `deconv(g, f) = ${JSON.stringify(deconv(g, f))}\n`;
|
||||
output += `f = ${JSON.stringify(f)}\n`;
|
||||
output += `deconv(g, h) = ${JSON.stringify(deconv(g, h))}\n`;
|
||||
console.log(output);
|
||||
}
|
||||
|
||||
main();
|
||||
Loading…
Add table
Add a link
Reference in a new issue