# matlab代做 | report | quiz | 代做html | lab代做 – HW 5 matlab practice

### HW 5 practice

matlab代做 | report | quiz | 代做html | lab代做 – 这个题目属于一个report的代写任务, 是比较有代表性的matlab/report/html等代写方向, 这是值得参考的lab代写的题目 Please submit 2 files: (1) the mat lab code file, name it as Your nameStudentIDHW5.m. Make sure the code is executable. A simple template is provided; (2) a pdf file, name it as Your nameStudentIDHW5.pdf. The pdf file should include necessary graphs and word explanations for each problem.

``````Writerng(123)at the beginning of each question in your.mfile.
Read the help page mentioned in the footnote of this document patiently.
``````

#### Problem 1.

In quiz 4, the last question: letXbe a continuous random variable andFX(x) be its cumulative distribution function. The random variableFX(X) follows a standard uniform distribution. Question 1-(i) (2 points):Verify this statement of standard logistic distribution. Generating N= 100000 realizations ofFX(X). Plot the empirical cdf (1 point) and plot the empirical pdf ( point). The cumulative distribution function of logistic random variable is in HW4. Please set= 0 and s= 1. You can use the built-in function in matlab (e.g., Method 2 in HW4) to generate logistic random variable^1. DO NOT just generateNrealizations of standard uniform distribution and then make the plot. Your code will be checked. Question 1-(ii) (2 points):Redo Question 1-(i) withXbeing standard exponential random variable (set= 1). The cumulative distribution function of standard exponential random variable is given in the slide and you can find it in wikipedia as well.

#### Problem 2.

Using rejection method to generate random variable following inverse Gaussian distribution, denoted asX. Note that the density function of inverse Gaussian distribution is

``````fX(x|,) =
``````
``````(
2 x^3
``````
##### ) 1 / 2
``````e
``````

2 (x (^2) x)^2 , ifx> 0 , 0 , otherwise. Set== 1. (^1) You do not have to use inverse CDF or rejection method via standard uniform random variable to generate logistic random variable. But I cant prevent you from doing that. 1

2 AuthorArticle Short Title

Refer to Lecture 10 for the procedure of rejection method, where we use rejection method to generate realizations of standard normal random variable. Question 2-(i) (1 points):Find the maximum value off(x|,), i.e., maxx> 0 f(x|,). Denote this value asM. ReportM, keeping 1 digit after the decimal point (round up, e.g., 2.11 round to 2 .2). Question 2-(ii) (1 points):Note that the support ofX is (0,+). We need to do some truncation. Find the value xsuch that the probability ofXbeing no greater than xis 0.99999, i.e.,

``````FX(x) = 0. 99999 ,
``````

where FX(x) =

##### (
``````
x
``````
``````(x
^1
``````
##### ))
``````+e^2 /
``````
##### (
``````
x
``````
``````(x
+ 1
``````
##### .

(x) is the cdf of standard normal random variable. The corresponding code in matlab is normcdf(x).^2 Using thefzerofunction^3 to find x. report x, keeping 1 digit after the decimal point (round up, e.g., 2.11 round to 2.2). Note that to usefzero, you need to first make an initial guess of the solution. And if your initial guess was not good enough, thefzeromay break down. You may have to guess it for a few times. Question 2-(iii) (2 points): GenerateN= 100000 realizations ofXusing rejection method. You will generate many coordi- nates (U[0,x], U[0,M]). Write awhileloop. Report the number of total number of coordinates you have used in order to generateN= 100000 realizations ofX(1 point). Plot the empirical pdf ofX(1 point). Question 2-(iv) (1 point):Redo Question 2-(iii). SetM= 1.5. Report the total number of coordinates you have used in order to generateN= 100000 realizations ofX.

#### Problem 3.

Consider the stochastic process we have mentioned in the lecture

``````dXt= (OXt)dt+dWt,withX 0 = 0, t[0,T].
``````
``````SetO= 2,= 0.5 andT= 4. Set t= 0.01.
Question 3-(i) (1 point):
``````

(^2) Seehttps://www.mathworks.com/help/stats/normcdf. html (^3) Seehttps://www.mathworks.com/help/matlab/ref/fzero.html

AuthorArticle Short Title 3

Generator one sample path of this process. Plot the sample path as a function of time. You can use either method we have mentioned in class. Question 3-(ii) (5 point): What is the distribution of maxt[0,T]Xt? This can be estimated by generatingR= 10000 replications and plot the empirical pdf of this quantity: the running maximum of the processXtfort[0,T]. Plot the empirical pdf (2 points). Report the mean value of maxt[0,T]Xt. Keep 4 digits (1 point). Report the probability that this quantity is between 1.6 and 2.1. Keep 4 digits (1 point), i.e.,

``````P
``````
##### {(
``````tmax[0,T]Xt
``````
##### }
``````Describe your findings (1 point).
``````