フィルターのクリア

Running Script 100 Times to get Mean

3 ビュー (過去 30 日間)
Hassan Taymuree
Hassan Taymuree 2022 年 12 月 6 日
回答済み: David Hill 2022 年 12 月 6 日
This is likely a super basic question but I'm having some trouble getting this to work. I have a random number generator that generates an array of 100 numbers. I'd like to run the script 100 times and capture the mean of the arrays and plot it into a histogram. This is likely just a for loop away from the solution, but im struggling to get it into place. Thanks!
x = [];
for i = 1:100
x(i) = normrnd(0,2)
end
y = [];
for i = 1:100
y(i) = 90*exp(0.25*x(i)+ (0.08-0.25^2))
end
I just want to plot the average of 100 y arrays

回答 (1 件)

David Hill
David Hill 2022 年 12 月 6 日
x=normrnd(0,2,100);
y=mean(90*exp(0.25*x+0.0175),2);
histogram(y,20)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by