I am running some basic examples about gaussian processes.
I want to manually generate a vector with samples of a gaussian process and then plot them.
First I create a Gaussian distribution and a sample vector s:
% CLEAR ALL
clear all
close all
% CREATE GAUSSIAN PROCESS
mu = 2
sigma = 1
d = makedist('Normal','mu',mu,'sigma',sigma);
% CREATE SAMPLE OF ABOVE GAUSSIAN PROCESS
s = random(d, [1000, 1]);
Then I plot the samples in a histogram:
% DISPLAY HOW DISTRIBUTION LOOKS LIKE
figure('Name', 'PDF')
title('GAUSSIAN DISTRIBUTION \mu=2 and \sigma=1')
histogram(s,100); hold on;
% DISPLAY HOW DISTRIBUTION SHALL LIKE
gauss_x = -5:0.01:5
gauss_y = ...
(1/(sigma*sqrt(2*pi))) ...
*exp( ...
(-1/2)*((gauss_x-mu)/sigma).^2 ...
)
plot(gauss_x, gauss_y); hold off;
Because the area is not normalised to 1, the theoretical gauss plot for mu=2 and sigma=1 appears at a much lower scale.
I try to normalise the area using Normalization parameter:
% NORMALIZE SAMPLE
figure('Name', 'PDF NORMALISED')
title('GAUSSIAN DISTRIBUTION \mu=2 and \sigma=1 NORM.')
histogram(s,100, 'Normalization','probability'); hold on;
plot(gauss_x, gauss_y); hold off;
But I still do not get the expected result, which would be the histogram being scaled with the theoretical curve.
What am I missing? Is it related to not understanding the Normalization parameter correctly or am I missing something related to the mathematical gaussian probability itself?

