听说贵公司的data center掉海里了?

微软启动Natick项目,尝试将数据中心放置于苏格兰奥克尼岛附近的海底,以利用海洋资源进行冷却并实现绿色能源供电。该数据中心计划运行12个月以评估其可行性和效益。

640


西雅图IT圈:seattleit

【今日作者】

PowerBall选号机

身体和灵魂总有一个要

走在买PowerBall的路上

640


继75亿喜提GitHub后,本周微软解锁了新玩法,把一个数据中心扔在了苏格兰的奥克尼岛周边的海里。

一个名为Natick的研究项目小组声称对此次事件负责,目的是探索将装满服务器的数据中心放在海底的好处及可行性。


640

奥克尼岛位于苏格兰的北部


一位微软发言人表示,“数据中心是互联网的骨干,我们要在保证速度的前提下让数据存储服务变得更环保。微软的Natick项目可能预示数据中心的新方向,能快速低成本的部署,还能为沿海地区提高更快的传输速度。”


640

海底数据中心长得就像倒了的塔


把一个data center打包起来扔水里并不是异想天开。


首先潮汐和洋流可以通过转换装置提供源源不断的电力;其次寒冷地区的海水可以为数据中心降温,离北极不远的奥克尼岛正符合这点。这一项目得到当地政府大力支持,苏格兰能源部长表示:“我们有政策鼓励,成熟的供应链,丰富的可再生资源和专业知识,是这类研究项目的理想场所。”


640

数据中心里面就是一排排架子,上面摆着服务器们


Natick项目负责人介绍,在海底安装部署一整个数据中心只需要3个月的时间。虽然这个实验脑洞很大,但如果成功,很快就会有更多的沿海地区可以迎来海底数据中心,岸上的人就能享受到更快速的网络连接。


640


那么,服务器都放在海底下有什么问题呢?你可能也想到了,这维修起来得多麻烦啊。对于这一点,Natick项目组的工程师表示,嗯,是个好问题,我们也在研究怎么办。

640

这个沉在苏格兰北部海底下的世界首个海底数据中心将试运营12个月,这期间的监测数据将决定项目未来的可行性。


小编认为除了维修,还得考虑下防水防盗防冲走,万一数据中心放在獐子岛,不声不响的逃跑了呢?



西雅图IT圈原创

仅有不到7%的公众号, 还在坚持原创

如果喜欢, 请分享我们的文章


每天加点料


GitHub收购案已经被网友玩坏

而且还是上了年纪的网友


640


640?

640?

投稿,转载,商业合作,请联系E-mail:

SeattleITquan@gmail.com

结合题目检查代码,提供可以优化的点 import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.spatial import KDTree from tqdm import tqdm plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False # 读取数据 def read_data(file_path): df = pd.read_excel(file_path, header=None) data = df.values x_coords_nautical = data[0, 1:].astype(float) x_coords_meter = x_coords_nautical * 1852 y_coords_meter = [] depth_data_meter = [] for i in range(1, len(data)): y_coords_meter.append(float(data[i, 0]) * 1852) depth_data_meter.append(data[i, 1:].astype(float)) return np.array(depth_data_meter), np.array(x_coords_meter), np.array(y_coords_meter) # 计算梯度 def calculate_gradient(depth_data): grad_x, grad_y = np.gradient(depth_data) return grad_x, grad_y # 构建坐标树用于快速查找最近点 def build_coord_tree(x_coords, y_coords): X, Y = np.meshgrid(x_coords, y_coords) coords = np.column_stack((X.ravel(), Y.ravel())) tree = KDTree(coords) return tree, X, Y # 查找最近点的深度 def find_depth(x, y, tree, depth_data, X, Y): _, idx = tree.query((x, y)) xi, yi = np.unravel_index(idx, X.shape) return X[yi, xi], Y[yi, xi], depth_data[yi, xi] # 自适应测线布设函数 def regional_adaptive_survey(x_coords, y_coords, depth_data, grad_threshold=0.05, parallel_spacing=100, sector_radius=200, num_sector_lines=12, sector_angle=60): X, Y = np.meshgrid(x_coords, y_coords) grad_x, grad_y = calculate_gradient(depth_data) grad_magnitude = np.sqrt(grad_x**2 + grad_y**2) # 构建KDTree加速坐标查找 tree, _, _ = build_coord_tree(x_coords, y_coords) plt.figure(figsize=(12, 10)) contour = plt.contourf(X, Y, depth_data, levels=50, cmap='terrain', alpha=0.7) plt.colorbar(contour, label='水深 ()') x_centers = (x_coords[:-1] + x_coords[1:]) / 2 y_centers = (y_coords[:-1] + y_coords[1:]) / 2 all_measurement_points = [] region_info = [] line_counter = 0 # 测线编号计数器 # 外层循环加进度条 total_cells = len(y_centers) * len(x_centers) pbar = tqdm(total=total_cells, desc="布设测线进度", unit="cell") for i in range(len(y_centers)): for j in range(len(x_centers)): pbar.update(1) # 更新进度条 cell_grad = grad_magnitude[i, j] center_x = x_centers[j] center_y = y_centers[i] cell_points = [] if cell_grad < grad_threshold: # 平行测线 if grad_magnitude[i, j] > 0: angle = np.arctan2(grad_y[i, j], grad_x[i, j]) - np.pi / 2 else: angle = 0 x_start = center_x - parallel_spacing * np.cos(angle) * 2 y_start = center_y - parallel_spacing * np.sin(angle) * 2 x_end = center_x + parallel_spacing * np.cos(angle) * 2 y_end = center_y + parallel_spacing * np.sin(angle) * 2 # 边界裁剪 x_start = np.clip(x_start, x_coords.min(), x_coords.max()) x_end = np.clip(x_end, x_coords.min(), x_coords.max()) y_start = np.clip(y_start, y_coords.min(), y_coords.max()) y_end = np.clip(y_end, y_coords.min(), y_coords.max()) plt.plot([x_start, x_end], [y_start, y_end], 'b--', linewidth=1.5, alpha=0.7) plt.text((x_start + x_end)/2, (y_start + y_end)/2, f'Line {line_counter}', fontsize=8, color='blue') line_counter += 1 x_points = np.linspace(x_start, x_end, 10) y_points = np.linspace(y_start, y_end, 10) for x, y in zip(x_points, y_points): _, _, depth = find_depth(x, y, tree, depth_data, X, Y) cell_points.append((x, y, depth)) all_measurement_points.append((x, y, depth)) x_plot, y_plot, _ = zip(*cell_points) plt.scatter(x_plot, y_plot, c='blue', s=20, alpha=0.8) region_info.append({ 'type': 'parallel', 'center': (center_x, center_y), 'gradient': cell_grad, 'points': cell_points }) else: # 扇形测线 angles = np.linspace(-np.radians(sector_angle/2), np.radians(sector_angle/2), num_sector_lines) # 为扇形角度循环添加子进度条 with tqdm(total=len(angles), desc="扇形角度", leave=False, unit="angle") as angle_pbar: cell_sector_points = [] # 添加扇形中心点 _, _, depth = find_depth(center_x, center_y, tree, depth_data, X, Y) cell_sector_points.append((center_x, center_y, depth)) all_measurement_points.append((center_x, center_y, depth)) for angle in angles: angle_pbar.update(1) x_end = center_x + sector_radius * np.cos(angle) y_end = center_y + sector_radius * np.sin(angle) x_end = np.clip(x_end, x_coords.min(), x_coords.max()) y_end = np.clip(y_end, y_coords.min(), y_coords.max()) plt.plot([center_x, x_end], [center_y, y_end], 'r--', linewidth=1.5, alpha=0.7) plt.text((center_x + x_end)/2, (center_y + y_end)/2, f'Line {line_counter}', fontsize=8, color='red') line_counter += 1 x_points = np.linspace(center_x, x_end, 8) y_points = np.linspace(center_y, y_end, 8) for x, y in zip(x_points, y_points): _, _, depth = find_depth(x, y, tree, depth_data, X, Y) cell_sector_points.append((x, y, depth)) all_measurement_points.append((x, y, depth)) x_plot, y_plot, _ = zip(*cell_sector_points) plt.scatter(x_plot, y_plot, c='red', s=20, alpha=0.8) region_info.append({ 'type': 'sector', 'center': (center_x, center_y), 'gradient': cell_grad, 'points': cell_sector_points }) pbar.close() # 关闭主进度条 plt.xlabel('东西方向位置 ()') plt.ylabel('南北方向位置 ()') plt.title('自适应测线布设\n蓝色为平行测线,红色为扇形测线') plt.axis('equal') plt.tight_layout() plt.savefig("adaptive_survey_lines.png", dpi=300, bbox_inches='tight') plt.show() return all_measurement_points, region_info # 主程序 if __name__ == "__main__": file_path = "C:/Users/Yeah/Desktop/数模/第七题/B题/附件(数据).xlsx" depth_data, x_coords, y_coords = read_data(file_path) grad_threshold = 0.05 parallel_spacing = 200 sector_radius = 300 num_sector_lines = 12 sector_angle = 90 measurement_points, region_info = regional_adaptive_survey( x_coords, y_coords, depth_data, grad_threshold=grad_threshold, parallel_spacing=parallel_spacing, sector_radius=sector_radius, num_sector_lines=num_sector_lines, sector_angle=sector_angle ) parallel_regions = sum(1 for r in region_info if r['type'] == 'parallel') sector_regions = sum(1 for r in region_info if r['type'] == 'sector') print(f"\n区域分布:") print(f"平行测线区域数量: {parallel_regions}") print(f"扇形测线区域数量: {sector_regions}") print(f"总测量点数: {len(measurement_points)}") print("\n示例测量点 (x, y, 深度):") for i, point in enumerate(measurement_points[:5]): print(f"点 {i+1}: ({point[0]:.2f}, {point[1]:.2f}, {point[2]:.2f})") 2023 年高教社杯全国大学生数学建模竞赛题目 (请先阅读“全国大学生数学建模竞赛论文格式规范”) B题 多波束测线问题 单波束测深是利用声波在水中的传播特性来测量水体深度的技术。声波在均匀介质中作匀 速直线传播,在不同界面上产生反射,利用这一原理,从测量船换能器垂直向海底发射声波信 号,并记录从声波发射到信号接收的传播时间,通过声波在海水中的传播速度和传播时间计算 出海水的深度,其工作原理如图1所示。由于单波束测深过程中采取单点连续的测量方法,因 此,其测深数据分布的特点是,沿航迹的数据十分密集,而在测线间没有数据。 (只有一个波束打到海底) 图1 单波束测深的工作原理 (多个独立的波束打到海底) 图2 多波束测深的工作原理 多波束测深系统是在单波束测深的基础上发展起来的,该系统在与航迹垂直的平面内一次 能发射出数十个乃至上百个波束,再由接收换能器接收由海底返回的声波,其工作原理如图 2 所示。多波束测深系统克服了单波束测深的缺点,在海底平坦的海域内,能够测量出以测量船 测线为轴线且具有一定宽度的全覆盖水深条带(图3)。 图3 条带、测线及重叠区域 图4 覆盖宽度、测线间距和重叠率之间的关系 多波束测深条带的覆盖宽度 𝑊 随换能器开角 𝜃 和水深 𝐷 的变化而变化。若测线相互平 行且海底地形平坦,则相邻条带之间的重叠率定义为 𝜂=1−𝑑 𝑊 ,其中 𝑑 为相邻两条测线的间 距,𝑊 为条带的覆盖宽度(图4)。若 𝜂<0,则表示漏测。为保证测量的便利性和数据的完 整性,相邻条带之间应有 10%~20% 的重叠率。 但真实海底地形起伏变化大,若采用海区平均水深设计测线间隔,虽然条带之间的平均重 叠率可以满足要求,但在水深较浅处会出现漏测的情况(图5),影响测量质量;若采用海区最 浅处水深设计测线间隔,虽然最浅处的重叠率可以满足要求,但在水深较深处会出现重叠过多 的情况(图6),数据冗余量大,影响测量效率。 图5 平均测线间隔 图6 最浅处测线间隔 问题1 与测线方向垂直的平面和海底坡面的交线构成一条与水平面夹角为 𝛼 的斜线(图 7),称 𝛼 为坡度。请建立多波束测深的覆盖宽度及相邻条带之间重叠率的数学模型。 图7 问题1的示意图 若多波束换能器的开角为 120∘,坡度为 1.5∘,海域中心点处的海水深度为70 m,利用上 述模型计算表1中所列位置的指标值,将结果以表1的格式放在正文中,同时保存到result1.xlsx 文件中。 表1 问题1的计算结果 测线距中心点 处的距离/m −800 −600 −400 −200 0 200 400 600 800 海水深度/m 覆盖宽度/m 与前一条测线 的重叠率/% 70 — 问题2 考虑一个矩形待测海域(图8),测线方向与海底坡面的法向在水平面上投影的夹 角为 𝛽,请建立多波束测深覆盖宽度的数学模型。 图8 问题2的示意图 若多波束换能器的开角为 120∘,坡度为 1.5∘,海域中心点处的海水深度为120 m,利用上 述模型计算表2中所列位置多波束测深的覆盖宽度,将结果以表2的格式放在正文中,同时保 存到result2.xlsx 文件中。 表2 问题2的计算结果 测量船距海域中心点处的距离/海里 覆盖宽度/m 0 0.3 0.6 0.9 0 测线 方向 夹角 /° 1.2 1.5 1.8 2.1 45 90 135 180 225 270 315 问题3 考虑一个南北长2海里、东西宽4海里的矩形海域内,海域中心点处的海水深度 为110 m,西深东浅,坡度为 1.5∘,多波束换能器的开角为 120∘。请设计一组测量长度最短、 可完全覆盖整个待测海域的测线,且相邻条带之间的重叠率满足 10%~20% 的要求。 问题4 海水深度数据(附件.xlsx)是若干年前某海域(南北长5海里、东西宽4海里) 单波束测量的测深数据,现希望利用这组数据为多波束测量船的测量布线提供帮助。在设计测 线时,有如下要求:(1) 沿测线扫描形成的条带尽可能地覆盖整个待测海域;(2) 相邻条带之间 的重叠率尽量控制在20% 以下;(3) 测线的总长度尽可能短。在设计出具体的测线后,请计算 如下指标:(1) 测线的总长度;(2) 漏测海区占总待测海域面积的百分比;(3) 在重叠区域中, 重叠率超过20% 部分的总长度。 注 在附件中,横、纵坐标的单位是海里,海水深度的单位是米。1海里=1852米。 附件 海水深度数据
08-27
根据最小二乘拟合所得的总等深线,完成问题4 2023 年高教社杯全国大学生数学建模竞赛题目 (请先阅读“全国大学生数学建模竞赛论文格式规范”) B题 多波束测线问题 单波束测深是利用声波在水中的传播特性来测量水体深度的技术。声波在均匀介质中作匀 速直线传播,在不同界面上产生反射,利用这一原理,从测量船换能器垂直向海底发射声波信 号,并记录从声波发射到信号接收的传播时间,通过声波在海水中的传播速度和传播时间计算 出海水的深度,其工作原理如图1所示。由于单波束测深过程中采取单点连续的测量方法,因 此,其测深数据分布的特点是,沿航迹的数据十分密集,而在测线间没有数据。 (只有一个波束打到海底) 图1 单波束测深的工作原理 (多个独立的波束打到海底) 图2 多波束测深的工作原理 多波束测深系统是在单波束测深的基础上发展起来的,该系统在与航迹垂直的平面内一次 能发射出数十个乃至上百个波束,再由接收换能器接收由海底返回的声波,其工作原理如图 2 所示。多波束测深系统克服了单波束测深的缺点,在海底平坦的海域内,能够测量出以测量船 测线为轴线且具有一定宽度的全覆盖水深条带(图3)。 图3 条带、测线及重叠区域 图4 覆盖宽度、测线间距和重叠率之间的关系 多波束测深条带的覆盖宽度 𝑊 随换能器开角 𝜃 和水深 𝐷 的变化而变化。若测线相互平 行且海底地形平坦,则相邻条带之间的重叠率定义为 𝜂=1−𝑑 𝑊 ,其中 𝑑 为相邻两条测线的间 距,𝑊 为条带的覆盖宽度(图4)。若 𝜂<0,则表示漏测。为保证测量的便利性和数据的完 整性,相邻条带之间应有 10%~20% 的重叠率。 但真实海底地形起伏变化大,若采用海区平均水深设计测线间隔,虽然条带之间的平均重 叠率可以满足要求,但在水深较浅处会出现漏测的情况(图5),影响测量质量;若采用海区最 浅处水深设计测线间隔,虽然最浅处的重叠率可以满足要求,但在水深较深处会出现重叠过多 的情况(图6),数据冗余量大,影响测量效率。 图5 平均测线间隔 图6 最浅处测线间隔 问题1 与测线方向垂直的平面和海底坡面的交线构成一条与水平面夹角为 𝛼 的斜线(图 7),称 𝛼 为坡度。请建立多波束测深的覆盖宽度及相邻条带之间重叠率的数学模型。 图7 问题1的示意图 若多波束换能器的开角为 120∘,坡度为 1.5∘,海域中心点处的海水深度为70 m,利用上 述模型计算表1中所列位置的指标值,将结果以表1的格式放在正文中,同时保存到result1.xlsx 文件中。 表1 问题1的计算结果 测线距中心点 处的距离/m −800 −600 −400 −200 0 200 400 600 800 海水深度/m 覆盖宽度/m 与前一条测线 的重叠率/% 70 — 问题2 考虑一个矩形待测海域(图8),测线方向与海底坡面的法向在水平面上投影的夹 角为 𝛽,请建立多波束测深覆盖宽度的数学模型。 图8 问题2的示意图 若多波束换能器的开角为 120∘,坡度为 1.5∘,海域中心点处的海水深度为120 m,利用上 述模型计算表2中所列位置多波束测深的覆盖宽度,将结果以表2的格式放在正文中,同时保 存到result2.xlsx 文件中。 表2 问题2的计算结果 测量船距海域中心点处的距离/海里 覆盖宽度/m 0 0.3 0.6 0.9 0 测线 方向 夹角 /° 1.2 1.5 1.8 2.1 45 90 135 180 225 270 315 问题3 考虑一个南北长2海里、东西宽4海里的矩形海域内,海域中心点处的海水深度 为110 m,西深东浅,坡度为 1.5∘,多波束换能器的开角为 120∘。请设计一组测量长度最短、 可完全覆盖整个待测海域的测线,且相邻条带之间的重叠率满足 10%~20% 的要求。 问题4 海水深度数据(附件.xlsx)是若干年前某海域(南北长5海里、东西宽4海里) 单波束测量的测深数据,现希望利用这组数据为多波束测量船的测量布线提供帮助。在设计测 线时,有如下要求:(1) 沿测线扫描形成的条带尽可能地覆盖整个待测海域;(2) 相邻条带之间 的重叠率尽量控制在20% 以下;(3) 测线的总长度尽可能短。在设计出具体的测线后,请计算 如下指标:(1) 测线的总长度;(2) 漏测海区占总待测海域面积的百分比;(3) 在重叠区域中, 重叠率超过20% 部分的总长度。 注 在附件中,横、纵坐标的单位是海里,海水深度的单位是米。1海里=1852米。 附件 海水深度数据 import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.spatial import KDTree from tqdm import tqdm from concurrent.futures import ProcessPoolExecutor import matplotlib plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False #读取数据 def read_data(file_path): df = pd.read_excel(file_path, header=None) data = df.values x_coords_nautical = data[0, 1:].astype(float) x_coords_meter = x_coords_nautical * 1852 y_coords_meter = [] depth_data_meter = [] for i in range(1, len(data)): y_coords_meter.append(float(data[i, 0]) * 1852) depth_data_meter.append(data[i, 1:].astype(float)) return np.array(depth_data_meter), np.array(x_coords_meter), np.array(y_coords_meter) #最小二乘法拟合 def least_squares_fit(x_coords, y_coords, depth_data): X, Y = np.meshgrid(x_coords, y_coords) A = np.column_stack((X.flatten()[:, np.newaxis], Y.flatten()[:, np.newaxis], np.ones((X.size, 1)))) B = depth_data.flatten() coefficients, residuals, rank, s = np.linalg.lstsq(A, B, rcond=None) a, b, c = coefficients Z_fit = a * X + b * Y + c residuals = depth_data - Z_fit ssr = np.sum(residuals**2) y_mean = np.mean(depth_data) sst = np.sum((depth_data - y_mean)**2) ssr_model = np.sum((Z_fit - y_mean)**2) r_squared = 1 - ssr / sst mse = ssr / (depth_data.size - 3) return a, b, c, ssr, r_squared, mse #评估 def evaluate_fit(depth_data, Z_fit): residuals = depth_data - Z_fit #残差平方和(SSR) ssr = np.sum(residuals**2) #总平方和(SST) y_mean = np.mean(depth_data) sst = np.sum((depth_data - y_mean)**2) #回归平方和(SSR_model) ssr_model = np.sum((Z_fit - y_mean)**2) #决定系数R² r_squared = 1 - ssr / sst #调整后的决定系数R²_adj(考虑变量数量) n = depth_data.size # 样本数量 p = 2 # 自变量数量 r_squared_adj = 1 - (1 - r_squared) * (n - 1) / (n - p - 1) #均方误差(MSE) mse = ssr / (n - p - 1) # 自由度调整 #平均绝对误差(MAE) mae = np.mean(np.abs(residuals)) #平均绝对百分比误差(MAPE) mape = np.mean(np.abs(residuals / depth_data)) * 100 return { 'SSR': ssr, 'SST': sst, 'SSR_model': ssr_model, 'R_squared': r_squared, 'R_squared_adj': r_squared_adj, 'MSE': mse, 'MAE': mae, 'MAPE': mape } #3d def plot_seafloor(x_coords, y_coords, depth_data): X, Y = np.meshgrid(x_coords, y_coords) fig = plt.figure(figsize=(12, 8)) ax = fig.add_subplot(111, projection='3d') surf = ax.plot_surface(X, Y, depth_data, cmap='terrain', linewidth=0, antialiased=True) fig.colorbar(surf, shrink=0.5, aspect=5, label='水深 ()') ax.set_xlabel('东西方向位置 ()') ax.set_ylabel('南北方向位置 ()') ax.set_zlabel('水深 ()') ax.set_title('三维海底地形图') ax.view_init(elev=35, azim=-45) plt.tight_layout() plt.savefig("seafloor_terrain.png", dpi=300, bbox_inches='tight') plt.show() #2d def plot_depth_contour(x_coords, y_coords, depth_data): X, Y = np.meshgrid(x_coords, y_coords) plt.figure(figsize=(12, 8)) contour = plt.contourf(X, Y, depth_data, levels=100, cmap='terrain') plt.colorbar(contour, label='水深 ()') cline = plt.contour(X, Y, depth_data, levels=100, colors='black', linewidths=0.5) plt.clabel(cline, inline=True, fontsize=8) plt.xlabel('东西方向位置 ()') plt.ylabel('南北方向位置 ()') plt.title('二维水深等高线图') plt.tight_layout() plt.savefig("depth_contour.png", dpi=300, bbox_inches='tight') plt.show() #最小二乘法拟合3d def plot_fitted_plane(x_coords, y_coords, depth_data, a, b, c): X, Y = np.meshgrid(x_coords, y_coords) Z = a * X + b * Y + c fig = plt.figure(figsize=(12, 8)) ax = fig.add_subplot(111, projection='3d') surf_real = ax.plot_surface(X, Y, depth_data, cmap='terrain', linewidth=0, antialiased=True, alpha=0.7) surf_fit = ax.plot_surface(X, Y, Z, cmap='viridis', linewidth=0, antialiased=True, alpha=0.7) fig.colorbar(surf_real, shrink=0.5, aspect=5, label='水深 ()') ax.set_xlabel('东西方向位置 ()') ax.set_ylabel('南北方向位置 ()') ax.set_zlabel('水深 ()') ax.set_title('海底地形与最小二乘法拟合平面') ax.view_init(elev=35, azim=-45) plt.tight_layout() plt.savefig("fitted_plane.png", dpi=300, bbox_inches='tight') plt.show() #最小二乘法拟合2d def plot_fitted_contour(x_coords, y_coords, depth_data, a, b, c): X, Y = np.meshgrid(x_coords, y_coords) Z = a * X + b * Y + c plt.figure(figsize=(12, 8)) contour_real = plt.contourf(X, Y, depth_data, levels=50, cmap='terrain', alpha=0.7) contour_fit = plt.contour(X, Y, Z, levels=20, cmap='viridis', linewidths=2) plt.colorbar(contour_real, label='水深 ()') plt.clabel(contour_fit, inline=True, fontsize=8) plt.xlabel('东西方向位置 ()') plt.ylabel('南北方向位置 ()') plt.title('原始海底地形与最小二乘法拟合等高线') plt.tight_layout() plt.savefig("fitted_contour.png", dpi=300, bbox_inches='tight') plt.show() #主程序 if __name__ == "__main__": file_path = "C:/Users/Yeah/Desktop/数模/第七题/B题/附件(数据).xlsx" depth_data, x_coords, y_coords = read_data(file_path) #实际地形图 plot_seafloor(x_coords, y_coords, depth_data) plot_depth_contour(x_coords, y_coords, depth_data) #最小二乘法拟合 a, b, c, ssr, r_squared, mse = least_squares_fit(x_coords, y_coords, depth_data) print(f"\n最小二乘法拟合结果:") print(f"平面方程: z = {a:.4f}x + {b:.4f}y + {c:.4f}") print(f"其中x为东西方向,y为南北方向,z为水深") #评估指标 print(f"\n拟合质量评估:") print(f"残差平方和 (SSR): {ssr:.4f}") print(f"决定系数 (): {r_squared:.4f}") print(f"均方误差 (MSE): {mse:.4f}") #拟合图像 plot_fitted_plane(x_coords, y_coords, depth_data, a, b, c) plot_fitted_contour(x_coords, y_coords, depth_data, a, b, c)
08-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值