以下是代码(数据比较多)
xAr = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 9.5, 10.0,
10.3, 10.6, 10.8, 11.0, 11.2, 11.4, 11.6, 11.8, 12.0, 12.2, 12.5,
12.7, 13.0, 13.3, 13.5, 13.8, 14.0, 14.2, 14.4, 14.6, 14.8, 15.0,
15.2, 15.4, 15.6, 15.8, 16.0, 16.2, 16.4, 16.6, 16.8, 17.0, 17.3,
17.6, 18.0, 18.5, 19.0, 19.5, 20.0, 20.5, 21.0, 21.5, 22.0, 22.5,
23.0, 23.5, 24.0, 24.2, 24.4, 24.6, 24.8, 25.0, 25.3, 25.6, 25.9,
26.2, 26.5, 26.8, 27.1, 27.3, 27.5, 27.7, 27.9, 28.2, 28.5, 28.8,
29.1, 29.4, 29.7, 30.0, 30.5, 31.0, 31.5, 32.0, 32.5, 33.0, 33.5,
34.0, 34.5, 35.0, 35.5, 35.8, 36.2, 36.5, 36.8, 37.1, 37.4, 37.7,
38.0, 38.2, 38.4, 38.6, 38.8, 39.0, 39.2, 39.4, 39.6, 39.8, 40.0,
40.2, 40.4, 40.6, 40.8, 41.0, 41.3, 41.6, 42.0, 42.5, 43.0, 43.5,
44.0, 44.5, 45.0, 45.5, 46.0, 46.5, 47.0, 47.4, 47.8, 48.2, 48.6,
49.0, 49.3, 49.6, 49.9, 50.2, 50.5, 50.8, 51.0, 51.2, 51.4, 51.6,
51.8, 52.0, 52.2, 52.4, 52.6, 52.8, 53.0, 53.3, 53.6, 53.9, 54.2,
54.5, 54.8, 55.1, 55.5, 56.0, 56.5, 57.0, 57.5, 58.0, 58.5, 59.0,
59.5, 60.0, 60.5, 61.0, 61.5, 62.0, 62.5, 63.0, 63.5, 64.0, 64.2,
64.4, 64.6, 64.8, 65.0, 65.2, 65.4, 65.6, 65.8, 66.0, 66.2, 66.4,
66.6, 66.9, 67.2, 67.5, 68.0, 68.5, 69.0, 69.5, 70.0, 70.5, 71.0,
71.5, 72.0, 72.5, 73.0, 73.5, 74.0, 74.5, 75.0, 75.3, 75.6, 75.9,
76.2, 76.5, 76.8, 77.1, 77.4, 77.7, 78.0, 78.2, 78.4, 78.6, 78.8,
79.0, 79.2, 79.4, 79.6, 79.8, 80.0, 80.3, 80.6, 81.0, 81.5, 82.0,
82.5, 83.0, 83.5, 84.0, 84.5, 85.0};
UAr = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.7, 1.5,
2.0, 2.7, 3.4, 3.9, 4.6, 5.3, 5.7, 6.3, 6.6, 6.7, 7.3, 7.8, 8.2,
8.5, 8.7, 8.9, 9.0, 9.1, 9.3, 9.3, 9.4, 9.3, 9.3, 9.4, 9.5, 9.6,
9.5, 9.5, 9.4, 9.4, 9.3, 9.2, 8.7, 8.4, 7.9, 7.0, 5.9, 4.8, 3.7,
2.7, 1.9, 1.3, 1.2, 1.4, 2.3, 4.1, 6.5, 7.3, 8.6, 9.7, 10.4, 11.2,
11.7, 12.9, 13.5, 14.1, 14.4, 14.8, 15.0, 15.1, 15.2, 15.1, 15.1,
14.9, 14.5, 14.2, 13.6, 12.8, 12.1, 11.4, 9.7, 7.6, 5.6, 3.9, 2.2,
1.2, 0.7, 1.2, 3.0, 5.8, 9.1, 10.5, 12.8, 14.3, 15.6, 16.5, 17.7,
18.5, 19.4, 20.1, 20.4, 20.7, 21.1, 21.3, 21.4, 21.3, 21.4, 21.5,
21.5, 21.4, 21.3, 21.0, 20.5, 20.2, 19.4, 18.5, 17.4, 15.3, 13.0,
10.1, 7.7, 5.5, 3.9, 2.8, 3.0, 4.8, 8.0, 10.2, 12.9, 15.3, 17.9,
19.9, 21.2, 22.7, 23.8, 24.5, 25.4, 26.2, 26.7, 27.1, 27.2, 27.5,
27.8, 28.0, 28.2, 28.2, 28.1, 28.0, 27.8, 27.3, 27.0, 26.3, 25.5,
24.5, 23.2, 21.8, 19.8, 17.2, 14.8, 12.1, 10.3, 9.8, 11.2, 13.0,
14.9, 17.9, 20.4, 23.2, 25.6, 28.3, 30.2, 32.3, 34.0, 35.3, 35.7,
36.0, 36.3, 36.5, 36.7, 36.8, 36.9, 36.9, 36.8, 36.7, 36.5, 36.2,
35.7, 35.1, 34.3, 33.4, 31.3, 29.0, 27.0, 24.5, 23.2, 22.5, 22.3,
23.1, 24.3, 26.1, 28.1, 30.4, 32.5, 35.4, 38.4, 39.8, 41.2, 42.6,
43.6, 44.6, 45.9, 46.9, 47.8, 48.5, 49.1, 49.4, 49.7, 49.9, 50.1,
50.4, 50.6, 50.6, 50.6, 50.5, 50.3, 49.8, 49.3, 48.5, 47.1, 45.8,
44.5, 43.4, 42.5, 42.5, 42.6, 43.1};
LiAr = Table[{xAr[[i]], UAr[[i]]}, {i, 1, 238}];
(*最小二乘法拟合,代码照抄的BSplineCurve自带帮助*)
uparam[pts_] := N[Range[0, 1, 1/(Length[pts] - 1)]];
kfun[n_, d_] :=
Join[ConstantArray[0, d], Range[0, 1, 1/(n - d)],
ConstantArray[1, d]];
mbasis[pts_, n_, d_] :=
With[{param = uparam[pts]},
Table[BSplineBasis[{d, kfun[n, d]}, j - 1, param[[i]]], {i,
Length[param]}, {j, n}]];
ctrlpts = LeastSquares[mbasis[LiAr, 75, 3], LiAr]; Graphics[
BSplineCurve[ctrlpts, SplineDegree -> 3], PlotRange -> {0, 85},
Frame -> True, ImageSize -> Medium]
可以画出一条曲线。我想把这条曲线当作一个函数来处理,比如求解它的极值点位置或者对其进行微分、积分操作,请问该怎么做?谢谢大家!
xAr = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 9.5, 10.0,
10.3, 10.6, 10.8, 11.0, 11.2, 11.4, 11.6, 11.8, 12.0, 12.2, 12.5,
12.7, 13.0, 13.3, 13.5, 13.8, 14.0, 14.2, 14.4, 14.6, 14.8, 15.0,
15.2, 15.4, 15.6, 15.8, 16.0, 16.2, 16.4, 16.6, 16.8, 17.0, 17.3,
17.6, 18.0, 18.5, 19.0, 19.5, 20.0, 20.5, 21.0, 21.5, 22.0, 22.5,
23.0, 23.5, 24.0, 24.2, 24.4, 24.6, 24.8, 25.0, 25.3, 25.6, 25.9,
26.2, 26.5, 26.8, 27.1, 27.3, 27.5, 27.7, 27.9, 28.2, 28.5, 28.8,
29.1, 29.4, 29.7, 30.0, 30.5, 31.0, 31.5, 32.0, 32.5, 33.0, 33.5,
34.0, 34.5, 35.0, 35.5, 35.8, 36.2, 36.5, 36.8, 37.1, 37.4, 37.7,
38.0, 38.2, 38.4, 38.6, 38.8, 39.0, 39.2, 39.4, 39.6, 39.8, 40.0,
40.2, 40.4, 40.6, 40.8, 41.0, 41.3, 41.6, 42.0, 42.5, 43.0, 43.5,
44.0, 44.5, 45.0, 45.5, 46.0, 46.5, 47.0, 47.4, 47.8, 48.2, 48.6,
49.0, 49.3, 49.6, 49.9, 50.2, 50.5, 50.8, 51.0, 51.2, 51.4, 51.6,
51.8, 52.0, 52.2, 52.4, 52.6, 52.8, 53.0, 53.3, 53.6, 53.9, 54.2,
54.5, 54.8, 55.1, 55.5, 56.0, 56.5, 57.0, 57.5, 58.0, 58.5, 59.0,
59.5, 60.0, 60.5, 61.0, 61.5, 62.0, 62.5, 63.0, 63.5, 64.0, 64.2,
64.4, 64.6, 64.8, 65.0, 65.2, 65.4, 65.6, 65.8, 66.0, 66.2, 66.4,
66.6, 66.9, 67.2, 67.5, 68.0, 68.5, 69.0, 69.5, 70.0, 70.5, 71.0,
71.5, 72.0, 72.5, 73.0, 73.5, 74.0, 74.5, 75.0, 75.3, 75.6, 75.9,
76.2, 76.5, 76.8, 77.1, 77.4, 77.7, 78.0, 78.2, 78.4, 78.6, 78.8,
79.0, 79.2, 79.4, 79.6, 79.8, 80.0, 80.3, 80.6, 81.0, 81.5, 82.0,
82.5, 83.0, 83.5, 84.0, 84.5, 85.0};
UAr = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.7, 1.5,
2.0, 2.7, 3.4, 3.9, 4.6, 5.3, 5.7, 6.3, 6.6, 6.7, 7.3, 7.8, 8.2,
8.5, 8.7, 8.9, 9.0, 9.1, 9.3, 9.3, 9.4, 9.3, 9.3, 9.4, 9.5, 9.6,
9.5, 9.5, 9.4, 9.4, 9.3, 9.2, 8.7, 8.4, 7.9, 7.0, 5.9, 4.8, 3.7,
2.7, 1.9, 1.3, 1.2, 1.4, 2.3, 4.1, 6.5, 7.3, 8.6, 9.7, 10.4, 11.2,
11.7, 12.9, 13.5, 14.1, 14.4, 14.8, 15.0, 15.1, 15.2, 15.1, 15.1,
14.9, 14.5, 14.2, 13.6, 12.8, 12.1, 11.4, 9.7, 7.6, 5.6, 3.9, 2.2,
1.2, 0.7, 1.2, 3.0, 5.8, 9.1, 10.5, 12.8, 14.3, 15.6, 16.5, 17.7,
18.5, 19.4, 20.1, 20.4, 20.7, 21.1, 21.3, 21.4, 21.3, 21.4, 21.5,
21.5, 21.4, 21.3, 21.0, 20.5, 20.2, 19.4, 18.5, 17.4, 15.3, 13.0,
10.1, 7.7, 5.5, 3.9, 2.8, 3.0, 4.8, 8.0, 10.2, 12.9, 15.3, 17.9,
19.9, 21.2, 22.7, 23.8, 24.5, 25.4, 26.2, 26.7, 27.1, 27.2, 27.5,
27.8, 28.0, 28.2, 28.2, 28.1, 28.0, 27.8, 27.3, 27.0, 26.3, 25.5,
24.5, 23.2, 21.8, 19.8, 17.2, 14.8, 12.1, 10.3, 9.8, 11.2, 13.0,
14.9, 17.9, 20.4, 23.2, 25.6, 28.3, 30.2, 32.3, 34.0, 35.3, 35.7,
36.0, 36.3, 36.5, 36.7, 36.8, 36.9, 36.9, 36.8, 36.7, 36.5, 36.2,
35.7, 35.1, 34.3, 33.4, 31.3, 29.0, 27.0, 24.5, 23.2, 22.5, 22.3,
23.1, 24.3, 26.1, 28.1, 30.4, 32.5, 35.4, 38.4, 39.8, 41.2, 42.6,
43.6, 44.6, 45.9, 46.9, 47.8, 48.5, 49.1, 49.4, 49.7, 49.9, 50.1,
50.4, 50.6, 50.6, 50.6, 50.5, 50.3, 49.8, 49.3, 48.5, 47.1, 45.8,
44.5, 43.4, 42.5, 42.5, 42.6, 43.1};
LiAr = Table[{xAr[[i]], UAr[[i]]}, {i, 1, 238}];
(*最小二乘法拟合,代码照抄的BSplineCurve自带帮助*)
uparam[pts_] := N[Range[0, 1, 1/(Length[pts] - 1)]];
kfun[n_, d_] :=
Join[ConstantArray[0, d], Range[0, 1, 1/(n - d)],
ConstantArray[1, d]];
mbasis[pts_, n_, d_] :=
With[{param = uparam[pts]},
Table[BSplineBasis[{d, kfun[n, d]}, j - 1, param[[i]]], {i,
Length[param]}, {j, n}]];
ctrlpts = LeastSquares[mbasis[LiAr, 75, 3], LiAr]; Graphics[
BSplineCurve[ctrlpts, SplineDegree -> 3], PlotRange -> {0, 85},
Frame -> True, ImageSize -> Medium]
可以画出一条曲线。我想把这条曲线当作一个函数来处理,比如求解它的极值点位置或者对其进行微分、积分操作,请问该怎么做?谢谢大家!