A Few Key Concepts to Take From One Complete Program and Apply to Another Very Similar Second Computer Program from an Exponential Distribution with Lambda Function Applied..
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, this may take a few minutes, be warned hehe.. but really shouldn't be too bad at all!
Here is first program:
nsamples=100; % number of samples
n = 225; % sample size 225
a = 1;
b = 2;
data = -3+9*rand(nsamples, n); % random 100x225 data sample from a uniform (0,1) distribution
cMean = mean(data, 2); % mean of each sample
answer_a = sum(cMean > a & cMean < b)/nsamples; % how many data means are between a and b
answer_b = mean(cMean);
answer_c = std(cMean, 1);
hist(cMean);
title('Generating 100 Samples of Size 225 Simulated U(-3,6) Random Numbers Histogram Question 1 Part d)'); %title of histogram
xlabel('Z'); %labeling x-axis
ylabel('Frequency'); %labeling y-axis
Here are the specifications for the first program:
1. Generate 100 samples of size 225 random numbers from U(-3,6). For each of these 100 samples calculate the mean.
a) Find the simulated probability that the mean is between 1 and 2.
b) Find the mean of the means.
c) Find the standard deviation of the means.
d) Draw the histogram of the means.
Here are the specifications for the second program with few differences from the first program to a second from an Exponential Distribution with Lambda function:
2. Generate 400 samples of size 625 random numbers from an Exponential distribution with lambda = 0.2. For each of these 400 samples calculate the mean.
a) Find the simulated probability that the mean is between 3 and 5.
b) Find the simulated mean of the means.
c) Find the simulated standard deviation of the means.
d) Draw the histogram of the means.
Thank you, Happy Holidays!
0 件のコメント
採用された回答
James Tursa
2016 年 12 月 1 日
I think your question is how to generate exponential(lambda) random numbers. If so, you can get them from uniform(0,1) numbers with the following:
T = -log(U)/lambda
Where U are the uniform numbers and T are the exponential numbers.
4 件のコメント
James Tursa
2016 年 12 月 1 日
編集済み: James Tursa
2016 年 12 月 1 日
Almost. E.g., this for data given the other inputs:
data = -log(rand(nsamples, n)) / lambda;
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!