/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Problem 24 Rayleigh Distribution. The Rayle... [FREE SOLUTION] | 91Ó°ÊÓ

91Ó°ÊÓ

Rayleigh Distribution. The Rayleigh distribution is another random number distribution that appears in many practical problems. A Rayleighdistributed 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 \(\left(n_{1}\right.\) and \(\left.n_{2}\right)\), and perform the following calculation. $$ r=\sqrt{n_{1}^{2}+n_{2}^{2}} $$ a. Create a function rayleigh \((\mathrm{n}, \mathrm{m})\) that returns an \(\mathrm{n} \mathrm{x} \mathrm{m}\) array of Rayleigh-distributed random numbers. If only one argument is supplied [rayleigh \((\mathrm{n})\) ], the function should return an \(\mathrm{n} \times \mathrm{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.

Short Answer

Expert verified
In this exercise, we implemented a function rayleigh(n, m) that returns an n x m array of Rayleigh-distributed random numbers using the formula \(r = \sqrt{n_1^2 + n_2^2}\), where \(n_1\) and \(n_2\) are normally distributed random values. We tested the function by creating an array of 20,000 Rayleigh-distributed random values and plotted a histogram, which showed a unimodal distribution with an early increase towards the mode and a gradual decrease. The mean and standard deviation of the Rayleigh distribution were calculated as \(\mu \approx 1.2533\) and \(\sigma_r \approx 0.6654\), respectively.

Step by step solution

01

Create the function rayleigh(n, m)

Here, we create a function named rayleigh that receives two parameters, n and m. The function should return n x m Rayleigh-distributed random numbers. The Rayleigh-distributed random value r can be obtained by the formula: \( r = \sqrt{n_1^2 + n_2^2} \), where \(n_1\) and \(n_2\) are two normally distributed random numbers. ```MATLAB function r = rayleigh(n, m) if nargin == 1 m = n; end if ~isscalar(n) || ~isscalar(m) || n < 1 || m < 1 error('Inputs must be positive scalar integers.'); end n1 = randn(n, m); n2 = randn(n, m); r = sqrt(n1.^2 + n2.^2); end ```
02

Test the function

We will now test the rayleigh function by creating an array of 20,000 Rayleigh-distributed random values. Then, we will plot a histogram of the array. ```MATLAB r_values = rayleigh(20000, 1); hist(r_values, 100); xlabel('Value'); ylabel('Frequency'); title('Histogram of Rayleigh-distributed random values'); ``` By running this code, we get a histogram representing the distribution of Rayleigh random values. The distribution looks like a unimodal distribution with an early increase towards the mode and then a gradual decrease.
03

Determine the mean and standard deviation

According to the definition of the Rayleigh distribution, if \(n_1\) and \(n_2\) are normally distributed random variables with mean 0 and standard deviation \(\sigma\), the mean and the standard deviation of the Rayleigh distribution can be calculated as follows: Mean: \(\mu = \sigma\sqrt{\frac{\pi}{2}}\) Standard deviation: \(\sigma_r = \sigma\sqrt{2 - \pi/2}\) Considering that \(n_1\) and \(n_2\) are standard normal random variables (mean = 0 and standard deviation = 1), the mean and standard deviation of the Rayleigh distribution are: Mean \(\mu = \sqrt{\frac{\pi}{2}} \approx 1.2533\) Standard deviation \(\sigma_r = \sqrt{2 - \pi/2} \approx 0.6654\) Alternatively, we can use the r_values array to empirically calculate the mean and standard deviation: ```MATLAB mean_r = mean(r_values); std_r = std(r_values); ``` The values obtained will be close to the theoretical mean and standard deviation.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91Ó°ÊÓ!

Key Concepts

These are the key concepts you need to understand to accurately answer the question.

MATLAB Programming
MATLAB is an extensively used programming platform for engineers and scientists to analyze data, develop algorithms, and create models. One of MATLAB's strengths is its vast collection of built-in functions that allow quick and efficient handling of mathematical computations. For instance, generating random numbers or employing built-in functions like randn, sqrt, and plotting functions. When writing MATLAB functions, best practices suggest implementing input validation and documentation to make the code robust and user-friendly. For instance, the rayleigh function in this exercise includes argument checking with nargin and error to ensure valid input, which helps prevent unexpected behavior and makes the function more reliable and easier to understand.
Random Number Generation
Random number generation is a fundamental aspect in simulations, statistical sampling, and various computational algorithms. In MATLAB, normal random numbers can be generated using the function randn, which produces values with a mean of 0 and a standard deviation of 1, following the standard normal distribution.

In this exercise, we create Rayleigh-distributed random numbers by transforming standard normal variables. The transformation involves square and addition operations followed by the square root function, yielding values that are Rayleigh distributed. The exercise emphasizes the way that distributions can be manipulated and transformed, which is a key concept in probability and statistics.
Histogram Plotting
A histogram is a graphical representation that breaks the data into bins and displays the frequency of data points within each bin. In MATLAB, the hist function is used to create histograms, vital for visualizing the underlying distribution of data sets. When plotting histograms of generated data, it can reveal the typical shape of the distribution, which, for a Rayleigh-distributed set, is unimodal showing a peak and then a gradual tail-off. Visualizing the Rayleigh distribution can help students gain intuition about how randomly generated datasets can conform to theoretical expectations.
Statistical Mean and Standard Deviation
The mean and standard deviation are fundamental statistical measures that describe the central tendency and spread of a data set, respectively. In the context of Rayleigh distribution, we use specific formulas to determine these measures, which differ from those of normal distribution due to the nature of the transformation applied to the normally distributed variables. Understanding these statistical measures is key for interpreting the generated Rayleigh-distributed data. MATLAB simplifies this process allowing users to compute these descriptors empirically using the mean and std functions, which validate the theoretical calculations based on the parameters of the underlying normal distribution.

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Read Traffic Density. Function random0 produces a number with a uniform probability distribution in the range \([0.0,1.0)\). This function is suitable for simulating random events if each outcome has an equal probability of occurring. However, in many events the probability of occurrence is not equal for every event, and a uniform probability distribution is not suitable for simulating such events. For example, when traffic engineers studied the number of cars passing a given location in a time interval of length \(t\), they discovered that the probability of \(k\) cars passing during the interval is given by the equation $$ P(k, t)=e^{-\lambda t} \frac{(\lambda t)^{4}}{k !} \text { for } t \geq 0, \lambda>0, \text { and } k=0,1,2, \ldots $$ This probability distribution is known as the Poisson distribution: it occurs in many applications in science and engineering. For example, the number of calls \(k\) to a telephone switchboard in time interval \(t\), the number of bacteria \(k\) in a specified volume \(t\) of liquid, and the number of failures \(k\) of a complicated system in time interval \(t\) all have Poisson distributions. Write a function to evaluate the Poisson distribution for any \(k, t\), and A. Test your function by calculating the probability of \(0,1,2, \ldots, 5\) cars passing a particular point on a highway in I minute, given that \(\lambda\) is \(1.6\) per minute for that highway. Plot the Poisson distribution for \(t=1\) and \(\lambda=1.6\).

Linear Least-Squares Fit. Develop a function that will calculate slope \(m\) and intercept \(b\) of the least-squares line that best fits an input data set. The input data points \((x, y)\) will be passed to the function in two input arrays, \(x\) and \(y\). (The equations describing the slope and intercept of the least- squares line are given in Example \(4.7\) in the previous chapter.) Test your function using a test program and the 20-point input data set given in Table 5.2.

Constant False Alarm Rate (CFAR). A simplified radar receiver chain is shown in Figure \(5.10 a\). When a signal is received in this receiver, it contains both the desired information (returns from targets) and thermal noise. After the detection step in the receiver, we would like to be able to pick out received target returns from the thermal noise background. We can do this be setting a threshold level, and then declaring that we see a target whenever the signal crosses that threshold. Unfortunately, it is

Probability of Detection \(\left(P_{2}\right)\) versus Probability of False Alarm \(\left(P_{\text {a }}\right)\). The signal strength returned by a radar target usually fluctuates over time. The target will be detected if its signal strength exceeds the detection threshold for any given look. The probability that the target will be detected can be calculated as $$ P_{i=}=\frac{\text { Number of Target Detections }}{\text { Total Number of Looks }} $$ Suppose that a specific radar looks repeatedly in a given direction. On cach look, the range between \(10 \mathrm{~km}\) and \(20 \mathrm{~km}\) is divided into 100 independent range samples (called range gates). One of these range gates contains a target whose amplitude has a normal distribution with a mean amplitude of 7 volts and a standard deviation of I volt. All 100 of the range gates contain system noise with a mean amplitude of 2 volts and a Rayleigh distribution. Determine both the probability of target detection \(P_{d}\) and the probability of a false alarm \(P_{1,}\) on any given look for detection thresholds of \(8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5\), and \(12.0 \mathrm{~dB}\). What threshold would you use for detection in this radar? (Hint: Perform the experiment many times for each threshold and average the results to determine valid probabilities.)

Modify the selection sort function developed in this chapter so that it accepts a second optional argument, which may be either ' up ' or "down'. If the argument is 'up', sort the data in ascending order. If the argument is 'dewn', sort the data in descending order. If the argument is missing, the default case is to sort the data in ascending order. (Be sure to handle the case of invalid arguments, and be sure to include the proper help information in your function.)

See all solutions

Recommended explanations on Psychology Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.