jeudi 1 avril 2021

How do I plot a probability density graph on MATLAB

I have a set of randomly generated data that I want to plot on the probability density graph to show that they are 'bad' randomly generated data. I tried using ksdensity but the graph is not what I was looking for.

This is the graph I am looking for enter image description here

And here is how I generated my random numbers.

x = rand(1);
r = 3.99;
X1 = zeros(5000,1);

for i = 1:5000
for j = 1:1

    X1(i,j) = r*x*(1-x);

    %For next iteration%
    x = X1(i,j); 

end
end

disp(X1);
plot(X1);
title("Generated Data Sequence for 5000 Iterations");
xlabel("Iteration Number n"); ylabel("X_n");

Any help would be much appreciated!




Aucun commentaire:

Enregistrer un commentaire