You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
590 B

'''
Author: SJ2050
Date: 2021-10-29 19:56:04
LastEditTime: 2021-10-29 22:57:17
Version: v0.0.1
Description: Solution for homework2.3.
Copyright © 2021 SJ2050
'''
import numpy as np
from matplotlib import pyplot as plt
if __name__ == '__main__':
ts = np.array([i for i in range(1000)])
xs = np.zeros(1000)
ys = np.zeros(1000)
xs[0] = np.random.rand(1)*2-1
ys[0] = np.random.rand(1)*2-1
for i in range(1, 1000):
xs[i] = xs[i-1]+np.random.rand(1)*2-1
ys[i] = ys[i-1]+np.random.rand(1)*2-1
plt.plot(xs, ys)
plt.show()