hold on is plotting strange lines to 0 when used for this code. Any ideas why?
Afficher commentaires plus anciens
gamma=1; alpha=0; beta=0; N=100; x0=50;
xn=zeros(1,N); xn(1)=x0;
realisations=1;
for i=1:realisations
hold on
for j=1:N-1
pn = (((gamma*xn(j)*(1-alpha))+(N-xn(j))*beta)/(gamma*xn(j)*(1-alpha)+...
(N-xn(j))*beta+(N-xn(j))*(1-beta)+gamma*xn(j)*alpha))*(xn(j)<=N);
xn(j+1)=binornd(N,pn);
plot(xn)
axis([-10 N+10 -10 N+10])
end
end
Which produces a plot like this:

I was hoping someone could help as to why it plots these lines to 0.
Thanks
1 commentaire
James McCusker
le 31 Oct 2017
Modifié(e) : James McCusker
le 31 Oct 2017
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Graphics Object Properties dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!