This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % Number of channels | |
| N = 10; | |
| N0 = 1; % Normalized noise level | |
| SNR_dB = 10; % Signal-to-noise ratio in dB | |
| P = 10**(SNR_dB / 10); | |
| % The channel specific gains drawn from Gaussian distribution | |
| g = abs(randn(N, 1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>Water-filling illustration in Chart.js</title> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.5.0/chart.min.js"> </script> | |
| </head> | |
| <body> | |
| <center> | |
| <div>Bisection step</div> | |
| <div style="width:50%"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Example code for https://scicoding.com/waterfilling/ | |
| import numpy as np | |
| # Number of channels | |
| N = 10 | |
| N0 = 1 # Normalized noise level | |
| SNR_dB = 10 # The signal to noise ratio in dB | |
| P = 10**(SNR_dB/10) # Sum power budget defined via the SNR | |
| # The channel specific gains drawn from Gaussian distribution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cvxpy as cp | |
| import numpy as np | |
| # Number of channels | |
| N = 10 | |
| N0 = 1 # Normalized noise level | |
| SNR_dB = 10 # The signal to noise ratio in dB | |
| P = 10**(SNR_dB/10) # Sum power budget defined via the SNR | |
| # The channel specific gains drawn from Gaussian distribution |