Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from matplotlib import pyplot as plt
- N = 1000;
- r_noise = np.random.uniform(-0.01,0.01,size=(1,N))
- theta_noise = np.random.uniform(-0.35,0.35,size=(1,N))
- r = 1 + r_noise;
- theta = np.pi/2 + theta_noise;
- x = r * np.cos(theta);
- y = r * np.sin(theta);
- x_meanNon = np.mean(x);
- y_meanNon = np.mean(y);
- x_meanLin = 0.0;
- y_meanLin = 1.0;
- fig = plt.figure(linewidth=2)
- plt.plot(x[:],y[:], 'c.')
- plt.plot(x_meanNon ,y_meanNon , 'ro')
- plt.plot(x_meanLin ,y_meanLin , 'bo')
- plt.text(x_meanNon ,y_meanNon , 'Nonlinear Mean')
- plt.text(x_meanLin ,y_meanLin , 'Linearized Mean')
- plt.xlabel("X")
- plt.ylabel("Y")
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement