Hello, I am in the process of doing the task and I have encountered a problem with drawing a histogram / graph.
below is the script that will perform the task of n rolls of two cubic dice and calculate the sum of the spots rolled:
count = 0;
for i=1:10
throws1 = randi(6, 1);
throws2 = randi(6, 1);
sumThrow = throws1 + throws2;
end
fprintf('suma : %d\n', sumThrow)
and a function that calculates the expected value and standard deviation:
function [x,y] = external_pdf(mu,sigma)
x = (mu-(3*sigma)):.1:(mu+(3*sigma))
y = 1/(sigma*sqrt(2*pi))*exp(-(x-mu).^2/(2*sigma^2))
end
I tries to draw a normalized histogram and plot a normal distribution graph with the parameters N (7, 2.41), using the command: normfit (7,2.41) - it is supposed to calculate the normal distribution, but when I try to draw it with the histogram command, I get the following drawing, and I'm rather doing something wrong.
below is the content of the task it performs:
Write a script that will do a task n rolls of two cubes and calculate
the total number of pips rolled. Find the expected value and standard deviation. Draw a number of
a calculated histogram and plot a normal distribution plot with parameters N (7, 2.41).
Use the randi, normfit, hist, trapz and plot functions.