Generate independent random variables X , and X₂ with pdf f ( x₁ ) and f ( x₂ )

조회 수: 1 (최근 30일)
Rose
Rose 2022년 6월 27일
답변: Moksh 2023년 9월 6일

- Plot the simulated pdf of the random number Z = X1 + X₂ - Determine the simulated mean and variance of resulting random numbers and compare them with theoretical value -Find the pdf of Z and compare with the simulation results

  댓글 수: 2
Torsten
Torsten 2022년 6월 28일
Are you able to generate random numbers for X1 and X2 ?
Are you able to add these random numbers to simulate Z ?
Are you able to get the mean and variance of the vector of generated random numbers for Z ?
Do you know how mean and variance for a sum of independent random vectors are computed ?
Do you know the convolution theorem to get the pdf for Z from those of X1 and X2 ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Moksh
Moksh 2023년 9월 6일
Hi Rose,
You can generate a uniform random distribution in MATLAB using the ‘rand’ function.
Further, the ‘histogram’ function in MATLAB provides the functionality of setting the ‘Normalization’ parameter through which you can plot the pdf for the random variable. Here is an example of this.
% Generate a random distribition for X1
X1 = randn(1, 1e5);
% Plotting the pdf
figure
histogram(X1, 'Normalization','pdf');
Similarly, you can create a distribution for ‘X2’ and create your required distribution ‘Z’.
Further you can use the ‘mean’ function for computing the mean of Z. For variance you can implement the standard formula using the ‘mean’ and ‘sum’ functions on Z.
For more information regarding the ‘rand, ‘histogram, ‘mean, and ‘sum’ functions please refer to the following documents.
Hope this helps!

카테고리

Help CenterFile Exchange에서 Exploration and Visualization에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by