1 / 23

CEE162/262c Lecture 13: Discrete Stochasticity

CEE162/262c Lecture 13: Discrete Stochasticity. c = 4 c = 3 c = 2 c = 1 c = 0. j = 0 j = 1 j = 2 j = 3 …. j = n. m+1 m. j j+1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %

harper
Download Presentation

CEE162/262c Lecture 13: Discrete Stochasticity

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CEE162/262c Lecture 13: Discrete Stochasticity CEE162/262c Lecture 13: Discrete stochasticity

  2. CEE162/262c Lecture 13: Discrete stochasticity

  3. CEE162/262c Lecture 13: Discrete stochasticity

  4. CEE162/262c Lecture 13: Discrete stochasticity

  5. CEE162/262c Lecture 13: Discrete stochasticity

  6. CEE162/262c Lecture 13: Discrete stochasticity

  7. c = 4 c = 3 c = 2 c = 1 c = 0 j = 0 j = 1 j = 2 j = 3 …. j = n CEE162/262c Lecture 13: Discrete stochasticity

  8. m+1 m j j+1 CEE162/262c Lecture 13: Discrete stochasticity

  9. CEE162/262c Lecture 13: Discrete stochasticity

  10. CEE162/262c Lecture 13: Discrete stochasticity

  11. CEE162/262c Lecture 13: Discrete stochasticity

  12. CEE162/262c Lecture 13: Discrete stochasticity

  13. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % File: jumps.m % Description: Stochastic test of the binomial distribution. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function jumps() nmax = 100; Pc = 0.04; trials = [10,100,1000,10000]; for numtrials=trials k = sum(rand(nmax,numtrials)<Pc); N = hist(k,[0:nmax])/numtrials; kt = [0:nmax]; p = choose(nmax,kt).*Pc.^kt.*(1-Pc).^(nmax-kt); sp = find(numtrials==trials); figure(1); subplot(length(trials),1,sp); plot(kt,N,'k.-',kt,p,'k:','markersize',10); if(sp<length(trials)) set(gca,'xticklabel',[]); end title(sprintf('%d trials',numtrials)); axis([0 20 0 .25]); end function c = choose(n,k) c = factorial(n)./(factorial(n-k).*factorial(k)); CEE162/262c Lecture 13: Discrete stochasticity

  14. CEE162/262c Lecture 13: Discrete stochasticity

  15. Binomial distribution approaches a normal distribution as n infinity. CEE162/262c Lecture 13: Discrete stochasticity

  16. CEE162/262c Lecture 13: Discrete stochasticity

  17. CEE162/262c Lecture 13: Discrete stochasticity

  18. CEE162/262c Lecture 13: Discrete stochasticity

  19. CEE162/262c Lecture 13: Discrete stochasticity

  20. % cranes.m – Stochastic crane population simulation nmax = 5; Pc = 0.04; numtrials = 10000; x0 = 100; r = 0.4; rc = 0.175; eps = 1e-10; kfound = 0; xend = zeros(numtrials,1); for trial=1:numtrials x = x0; cs = 0; for n=1:nmax s = rand()<Pc; cs = cs + s; x = s*(1+rc)*x + (1-s)*(1+r)*x; end ct(trial) = cs; if(kfound==0) xs = x; kfound = 1; else if(min(abs(x-xs))>eps) xs = [xs,x]; kfound = kfound + 1; end end xend(trial) = x; end xs = sort(xs); [Nc,c] = hist(ct,[0:nmax]); [Nx,x] = hist(xend,xs); fprintf('# Cat.\tp(Cat.)\t\tPop.\t\tp(Pop.)\n'); for n=1:length(Nx) fprintf('%d\t\t%.4f\t\t%.0f\t\t%.4f\n',... c(n),Nc(n)/numtrials,x(n),Nx(n)/numtrials); end Output: # Cat. p(Cat.) Pop. p(Pop.) 0 0.8159 317 0.0008 1 0.1694 378 0.0139 2 0.0139 451 0.1694 3 0.0008 537 0.8159 CEE162/262c Lecture 13: Discrete stochasticity

  21. CEE162/262c Lecture 13: Discrete stochasticity

  22. CEE162/262c Lecture 13: Discrete stochasticity

  23. CEE162/262c Lecture 13: Discrete stochasticity

More Related