I want to simulate values that represent a geometric distribution. The plot I have done using the code below seems to produce the right plot. But I want the x axis is badly out of position and also I want the x-axis to be numbered 1,2,3,etc instead of the 10,20,30,etc that I receive now. I also want to plot the Y-axis as a log scale.I am trying to get the plot of 'X' given in the code.
%Geometric Distribution%
N=100;%Number of simulation
P=0.1;
X=zeros(N,1);%simulation data
Ti=0;%Counter
for Ti=2:N
U=rand(1);
a=log10(U);
b=log10(1-P);
c=(a/b);
d=1+round(c);
X(Ti)=d;
Ti=Ti+1;
end
t = 0:N-1;
hist(X);
