Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CHANGING IN THE MATLAB CODE GIVEN clear N=100;% number of random variables to generate stp =0.1;% step size b=1;% Rayleigh parameter x=rand(1,N);% uniformly distributed random

image text in transcribed

CHANGING IN THE MATLAB CODE GIVEN

image text in transcribed

image text in transcribed

clear N=100;% number of random variables to generate stp =0.1;% step size b=1;% Rayleigh parameter x=rand(1,N);% uniformly distributed random numbers y=sqrt(blog(1x)); \% Rayleigh distributed random numbers f=find(y>2.2); \% find values out of the range of interest y(f)=[];% remove these values xcenter =[0.05:stp:1];% centers of the bins for the histogram ycenter =[0.05: stp: 2.2]; xabscissa =0: stp :1;% abscissa used for analytic results yabscissa =0:stp:2.5; xhist = hist (x,xcenter); \% compute histograms (not normalized) yhist = hist (y,y yenter ); xtrue = ones ( size (xabscissa)); \% compute the analytic values ytrue =2 *yabscissa/b. *exp (-yabscissa.^ 2/b ); \% plot results clf hold on plot (xabscissa, xtrue, ' k ') \% uniform distribution xlabel ('Magnitude Bins') ylabel ('Relative Number of Samples') title ('Histogram of Uniform Distribution') figure bar (ycenter, yhist. / (N*stp),1,' ') hold on plot (yabscissa, ytrue, ' k ) \% Rayleigh distribution xlabel ('Magnitude Bins') ylabel ('Relative Number of Samples') title ('Histogram of Rayleigh Distribution') In this course we discussed the generation of a single random variable of prescribed probability density by transformation of a random variable that was uniformly distributed on (0,1). Here, we shall utilize these results to show how some usefully distributed random variables can be generated by computer when the generation initially requires either two uniformly distributed random variables or two Gaussian variables. One common problem in the simulation of systems by a digital computer is the generation of Gaussian random variables. As an example, we note that two statistically independent Gaussian variables Y1 and Y2, each with zero mean and unit variance, can be generated by the transformations: Y1=2ln(X1)cos(2X2), and Y2=2ln(X1)sin(2X2), where X1 and X2 are two statistically independent random variables both uniformly distributed on (0,1). As another example, assume we start with two zero-mean, unit-variance, statistically independent gaussian random variables Y1 and Y2 (generated as above), and seek to transform them to two zero-mean gaussian variates W1 and W2 that have arbitrary variances, W12 and W22, and arbitrary correlation coefficient W. Then W1 and W2 can be generated as folows: W1=W1Y1 and W2=WW2Y1+W21W2Y2 where Y1 and Y2 are given by (1) and (2), respectively. 1. Use MATLAB to generate N=100 values x1n,n=1,2,,N, of a random variable X1 uniform on (0,1). Repeat the process for a second random variable X2 with values x2n. Next, use successively (3) and (4) to create two sets of values w1n and w2n,n=1,2,,N, of two zero-mean Gaussian random variables W1 and W2 having respective variances W12=4 and W22=9, and normalized correlation coefficient W=0.4. To determine the quality of our random variable's values, we find their means according to W^i=N1n=1Nwin,i=1and2 their variances according to Wi2=N1n=1N(winW^i)2,i=1and2 and their normalized correlation coefficient according to Tabulate your results in a table and record the percentage error of each quantity

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MFDBS 91 3rd Symposium On Mathematical Fundamentals Of Database And Knowledge Base Systems Rostock Germany May 6 9 1991

Authors: Bernhard Thalheim ,Janos Demetrovics ,Hans-Detlef Gerhardt

1991st Edition

3540540091, 978-3540540090

More Books

Students also viewed these Databases questions