Skip to content

Commit

Permalink
add fcnnls example
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Aug 20, 2019
1 parent bf3e955 commit 36b95c2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions examples/fcnnls.js
@@ -0,0 +1,14 @@
const { fcnnlsVector } = require('../dist/ml.js').FCNNLS;

// Example that allows to calculate the contribution of pure
// spectra in a mixture.

// columns correspond to pure sample
let matrix = [[1, 1, 1], [1, 1, 0], [1, 0, 0]];

let mixture = [5, 3, 1];

let result = fcnnlsVector(matrix, mixture);
console.log(result);

// should be close to 1,2,2

0 comments on commit 36b95c2

Please sign in to comment.