1. Write a Matlab function that implements the "water filling" algorithm for a set of N parallel channels with different noise levels. The input parameters of the function should be the value of the power P to be distributed over the N channels and a vector x = [x1,...., xN] containing the values of the noise over each dimension.
2. Write a Matlab script file that uses the function from Part 1 to apply "water filling" for distributing total power P = 10 over N = 5 parallel channels with noise levels x = [2, 3, 1, 6, 4] and that plots the noise and power distribution over the channels using "stacked bar" charts.