Return to Snippet

Revision: 67098
at August 11, 2014 22:16 by aturlapaty


Initial Code
"""
Created on Sun Aug 10 15:24:18 2014

@author: Anish

Spyder Editor

"""
# Importing libraries 
import os
os.system('cls')
import numpy as np
import matplotlib.pyplot as plt
#import math
#import time

#clf()
Nlim = 100
N = 145
nvec = np.linspace(0.0, N-1, num=N)
y1 = .2*sin(2.0*pi*nvec/N)
y2 = .2*cos(2.0*pi*nvec/N)

plt.plot(y1, y2, linewidth=2.0);
text(0, 0,'Radioactive Matter', fontsize = 12)

plt.xlim([-2,2])
plt.ylim([-2,2])

#nvec = np.linspace(0.0, N-1, num=N)
#y1 = sin(2.0*pi*nvec/N)
#y2 = cos(2.0*pi*nvec/N)
#text(-1, 0,'Atom', fontsize = 12)
plt.plot(y1,y2)
a = 1 
b = 2
l = 2

# for loop for recursive plotting of poisson process 
for x in range(1, Nlim):
    s = np.random.poisson(l, 1)
    rloc = np.random.uniform(a,b,s)
    ph_loc= np.random.uniform(-pi,pi,s)
    x_loc = rloc*cos(ph_loc)
    y_loc = rloc*sin(ph_loc)
    line1, = plt.plot(x_loc,y_loc,'or')
    ax = gca()
    draw()                         # redraw the canvas
    pause(.7)
    ax.lines.remove(line1)  # removes the most recent line

Initial URL
Poisson Process Simulation

Initial Description
A simple simulation of Poisson process: emission of particles from radio-active matter

Initial Title
Simulation of Poisson Process

Initial Tags


Initial Language
Python