From 505c1a9729d7e01e1d6da48a8c656ddf7cc76797 Mon Sep 17 00:00:00 2001 From: Remi Boure Date: Fri, 24 Mar 2023 08:47:11 +0100 Subject: [PATCH] =?UTF-8?q?Retirage=20de=20h=20=C3=A0=20chaque=20changemen?= =?UTF-8?q?t=20de=20fr=C3=A9quence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- src/main/java/fr/ntr/User.java | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 5da58cd..fdda839 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ build bin/ .idea .project -data.csv \ No newline at end of file +data.csv +.vscode \ No newline at end of file diff --git a/src/main/java/fr/ntr/User.java b/src/main/java/fr/ntr/User.java index 4d3f9e6..ec7e659 100644 --- a/src/main/java/fr/ntr/User.java +++ b/src/main/java/fr/ntr/User.java @@ -23,14 +23,15 @@ public class User { } public void generateBandwidth() { - double random = this.random.nextDouble(); - for(int i = 0; i < bandwidthTable.length; i++) { - for(int j = 0; j < bandwidthTable[i].length; j++) { + + for(int y = 0; y < bandwidthTable[0].length; y++) { + double random = this.random.nextDouble(); + for(int x = 0; x < bandwidthTable.length; x++) { double h = 1 * Math.sqrt(-2 * Math.log(1 - random)); double gain = h * Math.pow(10, random * 1/10) * Math.pow(1 / this.distance, 3.5); double spectralEfficiency = (20 * gain) / (15000 * (3.9*Math.pow(10, -21))); double mkn = Math.log(1 + spectralEfficiency) / Math.log(2); - this.bandwidthTable[i][j] = mkn; + this.bandwidthTable[x][y] = mkn; } } }