1.代码实现
import numpy as np a = np.array([[2, 3, 1], [1, -2, 4], [3, 8, -2], [4, -1, 9]]) b = np.array([4, -5, 13, -6]) # 最小二乘解 x3 = np.linalg.pinv(a) @ b print("最小二乘解为:", np.round(x3, 4)) print("学号:3014")
2.运行结果
posted on 2024-10-15 16:54 克卜勒星球 阅读(6) 评论(0) 编辑 收藏 举报