hw1_2_8_a - clear all; clc; close all; b=1; n=1000; for...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
clear all; clc; close all; b=1; n=1000; for j=1:10000 a=rand(1,n); x(j)=(b/n)*sum(a-0.5); end [e,r]=hist(x,100); plot(r,e); vr_b=(b^2)/(12*n); x1=-0.04:0.0001:0.04; t=5*((1/sqrt(2*pi*vr_b))*exp(-(x1.^2/(2*vr_b)))); hold plot(x1,t,'r'); p legend(' x','Gaussian RV'); figurea subplot (1,2,1); plot(r,e); for j=1:10000 a=rand(1,n); y(j)=(b/n)*sum(a-0.5); end e subplot (1,2,2); [e,r]=hist(y,100); plot(r,e); for j=1:10000 z(j)=sqrt((x(j)^2)+(y(j)^2)); end figure; [e,r]=hist(z,100); plot(r,e); %% Rayleigh using uniformly distributed RV b=3; n=10000; a=rand(1,n); vr_r=var(x); a=rand(1,n); for j=1:n y1(j)=sqrt(-(2*vr_r*log(a(j)))); end figure; [e,r]=hist(y1,100); plot(r,e); p %% effect of method (a) as n varies clear all; clc; % close all; b=3; n=[10,100,1000,10000]; for i=1:length(n) for j=1:10000 ax=rand(1,n(i));
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
x(j)=(b/n(i))*sum(ax-0.5); ay=rand(1,n(i)); y(j)=(b/n(i))*sum(ay-0.5); z(j,i)=sqrt((x(j)^2)+(y(j)^2)); end e [e(i,:),r(i,:)]=hist(z(:,i),100); % figure % hist(z(:,i),500); end figure; hold;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 01/20/2010.

Page1 / 3

hw1_2_8_a - clear all; clc; close all; b=1; n=1000; for...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online