Skip to content

Commit

Permalink
feat: calculate error
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierSwaak committed Jul 14, 2024
1 parent d075def commit 461d37e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/assets/uncertainty/uncertainty.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,20 @@ function updateCentre() {
y += ys[i]/ys.length;
}

var x_square_sum = 0;
var y_square_sum = 0;

for (var i = 0; i < xs.length; i++) {
x_square_sum += Math.pow((xs[i] - x), 2);
y_square_sum += Math.pow((ys[i] - y), 2);
}

var dx = Math.pow(x_square_sum, 0.5) / xs.length
var dy = Math.pow(y_square_sum, 0.5) / ys.length

const meanpoint = document.getElementById("mean_point");
meanpoint.style.left = x + "%";
meanpoint.style.top = y + "%";

console.log(y);
console.log(dx, dy);
}

0 comments on commit 461d37e

Please sign in to comment.