Hi, Could I get Sample Output for these two programs? Asked before but hadn't quite labeled everything correctly, thank you.

1 回表示 (過去 30 日間)
I have mac osx and tried installing scilab and octave for the past 2 hours and hasn't worked... here are the programs, thanks..
1.
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_1a = sum(cMean > a & cMean < b)/nsamples % how many data means are between a and b
answer_1b = mean(cMean)
answer_1c = 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.
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_2a = sum(cMean > a & cMean < b)/nsamples % how many data means are between a and b
answer_2b = mean(cMean)
answer_2c = std(cMean, 1)
hist(cMean);
title('Generating 400 Samples of Size 625 Simulated Lambda = 0.2 Random Numbers Histogram Question 2 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 again.

1.

answer_1a =
       1
answer_1b =
      1.4820
answer_1c =
      0.1781

2.

answer_2a =
      0.4800
answer_2b =
      4.9946
answer_2c =
      0.2078
  4 件のコメント
HrMmz
HrMmz 2016 年 12 月 2 日
ty for the second help here too really appreciate it coffee!!

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by