你可以使用MATLAB中的polyfit函数对给定的数据进行多项式拟合,并使用polyval函数计算得到的拟合曲线。以下是一个示例代码:
```matlab
% 输入数据
x = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200];
y = [0.0, 0.0, 0.098744, 0.332554, 0.577296, 0.738731, 0.810989, 0.836897, 0.852130, 0.867503, 0.882456, 0.896516, 0.908583, 0.916518, 0.921070, 0.925596, 0.931262, 0.936204, 0.939569, 0.942858, 0.946746, 0.949705, 0.950972, 0.952249, 0.955043, 0.958289, 0.960134, 0.960646, 0.961370, 0.963040, 0.965043, 0.966630, 0.967613, 0.968177, 0.968747, 0.969792, 0.971240, 0.972396, 0.972863, 0.973147, 0.973899, 0.974969, 0.975786, 0.976282, 0.976842, 0.977561, 0.978172, 0.979132, 0.979795, 0.980388, 0.980784, 0.981118, 0.981534, 0.982030, 0.982565, 0.983072, 0.983425, 0.983605, 0.983841, 0.984349, 0.984976, 0.985379, 0.985524, 0.985715, 0.986131, 0.986618, 0.986973, 0.987215, 0.987458, 0.987737, 0.988047, 0.988400, 0.988769, 0.989080, 0.989324, 0.989576, 0.989869, 0.990163, 0.990455, 0.990794, 0.991156, 0.991449, 0.991677, 0.991967, 0.992366, 0.992749, 0.993000, 0.993188, 0.993445, 0.993787, 0.994127, 0.994415, 0.994671, 0.994930, 0.995226, 0.995586, 0.995978, 0.996294, 0.996479, 0.996666, 0.996929];
% 多项式拟合
fit_order = 10; % 拟合多项式的阶数
coeffs = polyfit(x, y, fit_order);
% 计算拟合曲线
x_fit = linspace(min(x), max(x), 100);
y_fit = polyval(coeffs, x_fit);
% 绘制原始数据和拟合曲线
figure;
plot(x, y, 'ko', 'MarkerSize',
--- 光学专家Gpt |