24 Run rand (1,N) 4 times where N takes on 4 ditterent values: 100, Poo, 1000, 1
ID: 3743222 • Letter: 2
Question
24 Run rand (1,N) 4 times where N takes on 4 ditterent values: 100, Poo, 1000, 10000. Each time you run rand (1,N), plot a histogram using 20 bins displayed on a 2x2 aubplot roma t as shown in Fig. 1 posted on Canvas. Notice how the histogram looks more and more like the underlying uniform distribution on [0,1] as 4 the number of samples increases. Put the number of samples in the ticie i of each graph. For subplot (2,2,1), include your name in the title. Again, see 25 26 27 28 29 30 Fig. 1 as posted. Title font size 16. took back at 2100 slides for help with the title. 31Explanation / Answer
% select first subplot
subplot( 2 , 2 , 1 );
title('100 Samples');
% create 100 random numbers
arr1 = randn(1 , 100);
nbins = 20;
% plot the histogram
histogram(arr1 , nbins);
% select second subplot
subplot( 2 , 2 , 2 );
title('500 Samples');
% create 500 random numbers
arr2 = randn(1 , 500);
nbins = 20;
% plot the histogram
histogram(arr2 , nbins);
% select third subplot
subplot( 2 , 2 , 3 );
title('1000 Samples');
% create 100 random numbers
arr3 = randn(1 , 1000);
nbins = 20;
% plot the histogram
histogram(arr3,nbins);
% select fourth subplot
subplot( 2 , 2 , 4 );
title('10000 Samples');
% create 10000 random numbers
arr4 = randn(1 , 10000);
nbins = 20;
% plot the histogram
histogram(arr4 , nbins);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.