Could Someone Provide the Sample Output for these Two Programs? I don't own MATLAB or if you know another way for me to get sample output.. thank you.

1 次查看(过去 30 天)
1. MATLAB 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
2. MATLAB Program
nsamples=400; % number of samples
n = 625; % sample size 625
a = 3;
b = 5;
lambda = 0.2;
data = -log(rand(nsamples, n)) / lambda; % random 400x625 data sample from a uniform (3,5) 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 400 Samples of Size 625 Simulated Lambda = 0.2 Random Numbers Histogram Question 1 Part d)'); %title of histogram
xlabel('Z'); %labeling x-axis
ylabel('Frequency'); %labeling y-axis

采纳的回答

bio lim
bio lim 2016-12-2
编辑:bio lim 2016-12-2

Here you go.

1. MATLAB Program

   answer_a =
       1
answer_b =
      1.4854
answer_c =
      0.1598

2. MATLAB Program

   answer_a =
      0.4900
answer_b =
      5.0114
answer_c =
      0.2052
  5 个评论

请先登录,再进行评论。

更多回答(1 个)

KSSV
KSSV 2016-12-2
Google octave or scilab. Both these are open source and almost like MATLAB.

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by