upd
This commit is contained in:
23
course2/sem3/labs/lab4.02/scripts/main.py
Normal file
23
course2/sem3/labs/lab4.02/scripts/main.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
L = np.array([932, 832, 732, 632, 532])
|
||||
dx = np.array([3.56, 3.67, 3.00, 3.11, 2.33])
|
||||
|
||||
K, b = np.polyfit(L, dx, 1)
|
||||
|
||||
lambda_nm = 632.82
|
||||
lambda_mm = lambda_nm * 1e-6
|
||||
|
||||
d = lambda_mm / K
|
||||
|
||||
plt.figure()
|
||||
plt.scatter(L, dx)
|
||||
plt.plot(L, K * L + b)
|
||||
plt.xlabel("L, мм")
|
||||
plt.ylabel("Δx, мм")
|
||||
plt.savefig("1.png", bbox_inches="tight", dpi=300)
|
||||
plt.show()
|
||||
|
||||
print(K, d)
|
||||
|
||||
Reference in New Issue
Block a user