2024-10-17 03:04:08 +03:00
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
class lab1:
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def main(self):
|
|
|
|
x11 = np.random.normal(2, 1, [10, 1])
|
|
|
|
x21 = np.random.normal(6, 2, [10, 1])
|
|
|
|
x11_od=x11.flatten()
|
|
|
|
x21_od=x21.flatten()
|
|
|
|
|
|
|
|
mu_x11 = x11.mean()
|
|
|
|
sigma_x11 = x11.std()
|
|
|
|
|
|
|
|
mu_x21 = x21.mean()
|
|
|
|
sigma_x21 = x21.std()
|
|
|
|
|
|
|
|
print("Массив x11:")
|
|
|
|
print("Среднее значение:", mu_x11)
|
|
|
|
print("Среднеквадратическое отклонение:", sigma_x11)
|
|
|
|
|
|
|
|
print("Массив x21:")
|
|
|
|
print("Среднее значение:", mu_x21)
|
|
|
|
print("Среднеквадратическое отклонение:", sigma_x21)
|
|
|
|
|
|
|
|
corr_coeff=np.corrcoef(x11_od,x21_od)[0,1]
|
|
|
|
print("Коэффициент корреляции между x11 и x21:", corr_coeff)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
l1 = lab1()
|
|
|
|
l1.main()
|