Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB The Rayleigh distribution is another random number distribution that appe

ID: 3834510 • Letter: M

Question

MATLAB

The Rayleigh distribution is another random number distribution that appears in many practical problems. A Rayleigh-distributed random value can be created by taking the square root of the sum of the squares of two normally distributed random values. In other words, to generate a Rayleigh-distributed random value r, get two normally distributed random values (n_1 and n_2), and perform the following calculation: r = Squareroot n^2_1 + n^2_2) (a) Create a function rayleigh (n, m) that returns an n times m array of Rayleigh- distributed random numbers. If only one argument is supplied [rayleigh (n)], the function should return an n times n array of Rayleigh-distributed random numbers. Be sure to design your function with input argument checking and with proper documentation for the MATLAB help system. (b) Test your function by creating an array of 20,000 Rayleigh-distributed random values and plotting a histogram of the distribution. What does the distribution look like? (c) Determine the mean and standard deviation of the Rayleigh distribution.

Explanation / Answer

We know that the amplitudes Ak are Rayleigh distributed. The amplitude random variable A is the square root of intensity random variable I from Part (a). The intensity I is exponentially-distributed, with paramater = 0.5, as we saw in Part (a). Hence, we can calculate the theoretical value for the mean of amplitude A as follows < A >=< I > = Z 0 rer (20) = 1 2 r With = 0.5, we see that < A >= 1.2533. The theoretical standard deviation of the amplitude random variable A is calculated as follows var(A) = < A 2 > (< A >) 2 (21) = < I > 1 2 r 2 = 4 4 p Again, with = 0.5, we see that the theoretical standard deviation = var(A) = 0.6551. Table compares the theoretical values for the mean and standard deviation of the Rayleigh distribution with the empirical values obtained directly from the 10000-long sample of amplitude. The theoretical value for the mean of the Rayleigh-distributed amplitudes now allows us to construct the pdf, as follows fA(a) = ae a 2 2s2 s 2 where s = r 2 pi < A > (22) Finally, we compare the theoretical Rayleigh pdf constructed above with the histogram of amplitudes obtained directly from the 10000-long sample 11 {Ak} 1 k=10000. This comparison is shown in Figure 12 0 5 10 15 20 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 empirical and theoretical Rayleigh distributions Figure 12: Problem 5:[10 pts] (a) Figure 13 showsthe linearly transformed image image1 from Problem Set 1. For details of the linear transformation, we refer the reader to the solutions to Problem Set 1. We denote the transformed image in Figure 13 by I. original image Figure 13: 12 I(i, j) refers to the ij pixel value of the image. We take this pixel value to represent the variance of a complex Gaussian random variable c(i, j). The ij-th entry in a simulated 1-look coherent image L is then the magnitude squared of the complex random quantity c(i, j). L(i, j) = |c(i, j)| 2 (23) = r I(i, j) 2 x(i, j) !2 + r I(i, j) 2 y(i, j) 2 ! where x(i, j), y(i, j) are zero-mean, mutually independent, unit variance Gaussian-distributed random variables. We can use the Gaussian random number generator from Problem 4 to produce two arrays of random numbers (zero-mean, unit variance Gaussian distributed) x and y, with the same dimensions as the transformed image, from which we can simulate the 1- look coherent image by applying the equations in Equation set 24. Figure 15 showsthe resulting simulated 1-look coherent image. The grayscale display that produced this image is set such that pixel values at 255 or greater are mapped to pure white while values 0 or less are mapped to pure black. 1look coherent image Figure 14: (b) To simulate a 10-look coherent image, we average ten instances of 1-look coherent images of which Figure 14 in Part (a) is one realization L10 look(i, j) = X 10 k=1 L (k) (i, j) (24) where L (k) denotes the k-th realization of a 1-look coherent image. The resulting image is shown in Figure 15 We know from Problem 4 that each 13 [ht] 10look coherent image Figure 15: 1-look coherent image in the sum above is exponentially-distributed (it is an intensity image, formed from complex Gaussian r.vs). The expected value of this simulated 1-look coherent image is exactly the original transformed image in Figure 13, as can be seen from the following < L(i, j) > = < r I(i, j) 2 x(i, j) !2 + r I(i, j) 2 y(i, j) 2 ! >(25) = I(i, j) The average of 10 exponentially-distributed intensity images above approximates the expected 1-look coherent image. This approximation improves with more realizations (draws) in the averaging. Nevertheless, even by averaging 10 realizations of simulated 1-look coherent images, the resulting image seems to approach the mean, the original image, as can be observed in Figure 15. (c) From our results in Part (b), we would expect that averaging a large number of 1-look images would result in an image that looks quite similar to the original image in Figure 13. Analogous to Part (b), we average one hundred 1-look coherent images, the result of which is shown in Figure 16 (d) Theoretically, we would need an infinite number of realizations for the resulting to sum to converge on the statistical expectation of the exponentiallydistributed speckled images. However, as we can see from Figure 16, the average of 100 draws looks quite similar to the original Figure 13