QuestionQuestion

Transcribed TextTranscribed Text

1. Program up our "alternative" algorithm for simulating a Poisson TV X with mean a. at P(X = k) = e Here is the Pseudo Code: Alternative algorithm for generating a Poisson rv x with mean a: i Enter desired a > 0. Set X = 0, P = 1 ii Generate U ~ unif(0,1), set P = UP iii If P e then stop. Otherwise if P209 then set x = x+1 and go back to ix. iii Output X. (a) For o = 1, and o = 5. run the algorithm 1000 times to obtain n = 1000 copies of X. and see how close your empirical average is to the true value E(X) = 1. E(X) 5: 1000 1 E(X) 2 1000 [x Re-do for 72 = 10,000 copies of X. (b) For a = 5, P(X = 5) = €-556 = 0.17546.. See how close the following simulation estimate is to the correct answer, for n = 1000 and n = 10,000 (generated copies of X): 2 n where 1 {A} is the indicator rv for the event A: 1(A} = 1 if Aoccurs, 1(A} = 0 if A des not occur. 2. Recall the famous irrational number IT = 3.1415926535. We know that it can be expressed as the area of a disk of radius r = 1: A = xr2 = II. and hence a = 4 = where U is a continuous uniform TY over (0,1) (it has density function f(x) = 1, x € (0,1).) Obtain an approximation to * by generating 1000 iid U, and using 1000 1 x 2 4 1000 1 NOTE: When obtaining an empirical average estimate of the form E(X) i-1 (n some large integer) for efficiency you do not want to first generate and save all n of the X,. Instead you want to sum them up sequentially thus only saving one at a time: Initialize: SUM = 0. Count = 1 1. Generate X. Reset SUM = SUM+X. 2. If Count 3. Output SUM/n. 2

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

clear; clc; close all;
%1(a),1(b) Solutions
n=[1000 10000]; X1=zeros(1,length(n)); X5=zeros(1,length(n));
for i=1:length(n)
eval(['[X1_',num2str(n(i)),',P1_',num2str(n(i)),']=poisrv(1,n(i));']);
eval(['X1_',num2str(n(i)),'_avg=mean(X1_',num2str(n(i)),');']);
eval(['[X5_',num2str(n(i)),',P5_',num2str(n(i)),']=poisrv(5,n(i));']);
eval(['X5_',num2str(n(i)),'_avg=mean(X5_',num2str(n(i)),');']);
end...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$67.50
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available MATLAB for Engineering Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats