Edwinlr 发表于 2009-4-17 18:00

dingd主任请进

之前的那个我自己可能有些误解.我说下我原本的想法

一组数据,我想让拟合出来的曲线经过给定数据的最后一点,且给定数据曲线与拟合曲线在最后一点的切线方向相同.

即实验曲线与拟合曲线在给定数据最后一点上平滑相接.因为我后面还想将拟合曲线扩展到x=1附近

最后一点:x=0.162,y=527.1

我的想法是这样子:
1.拟合函数为:y =s-(s-312)*exp(-m*x^n)      //s,m,n为参数(与之前的帖子有不同)

2.因为有三个求知数,取实验最后三个数据点,代入上面方程,求出过最后三点的一个方程:s=574.7,m=11.48,n=1.05
即y0=574.7-(574.7-312)*exp(-11.48*x^1.05)

3.令y0曲线在最后一点的导数=待拟合曲线最后一点的导数,即他们在最后一点的切线方向相同
即 y0的导数为:y0`=-262.7*exp(-11.48*x^1.05) * (-11.48*1.05*x^0.05)
y0`在(0.162,527.1)的值为529.2

4.对待拟合函数求导,y`=-(s-312)*exp(-m*x^n) * (-m*n*x^(n-1))
y在(0.162,527.1)的值也应=上面的529.2

所以,约束方程应为:1.   527.1=s-(s-312)*exp(-m*0.162^n)
2.   529.2=-(s-312)*exp(-m*0.162^n) * (-m*n*0.162^(n-1))

编程如下:(请dingd主任帮忙算下,并给出图,谢谢~~~)
Variable x, y;
constant x1=0.1624717,y1=527.068036;
Parameter m,n,s;
Function y =s-(s-312)*exp(-m*x^n);
         y1=s-(s-312)*exp(-m*x1^n);
      529.2=-(s-312)*exp(-m*x1^n)*(-m*n*x1^(n-1));
Data;
0.0035711 312.2771892
0.0037729 314.8637028
0.0039895 317.2852979
0.0042211 319.5088295
0.00446 321.597142
0.0047139 323.6038375
0.0049826 325.422406
0.0052661 327.1372123
0.0055496 328.7845602
0.0058479 330.3119839
0.0061535 331.7873942
0.0064665 333.2892772
0.0067795 334.6913551
0.0071072 336.0217016
0.0074422 337.3231203
0.0077623 338.5759527
0.0081194 339.9107132
0.0084616 341.1303304
0.0087962 342.3632898
0.0091604 343.5940924
0.0095394 344.8611114
0.0098736 346.0044981
0.0102374 347.1861585
0.0106011 348.3797042
0.0109721 349.598862
0.0113652 350.8256212
0.0117655 352.0851894
0.0121731 353.3806635
0.0125805 354.6244181
0.0129804 355.851238
0.0133727 357.063108
0.0137944 358.3310316
0.0141864 359.5182615
0.0146004 360.7285163
0.0150142 361.9447253
0.015487 363.3122554
0.0159299 364.5807361
0.0163875 365.8759269
0.0168817 367.2548467
0.0173609 368.5939031
0.0178178 369.8485314
0.0183334 371.2258282
0.0188193 372.562809
0.0192755 373.7951008
0.0197683 375.084989
0.0203343 376.5648744
0.0208633 377.89957
0.02137 379.2271144
0.0219352 380.6384575
0.0224706 382.0113102
0.0230132 383.3237578
0.0235774 384.7318612
0.0241266 386.06497
0.0246975 387.4057648
0.0252388 388.6769844
0.0257944 389.9950723
0.0264009 391.389839
0.0269851 392.7301496
0.027569 394.0131653
0.0281743 395.3883443
0.0288304 396.8180743
0.0293986 398.0755104
0.030032 399.4118026
0.0306432 400.713914
0.0312467 401.9978879
0.0318862 403.2936388
0.0324962 404.5035571
0.0331567 405.8706737
0.033766 407.0944525
0.0344183 408.3713297
0.0351282 409.7426532
0.0358159 411.0837848
0.0365465 412.4515271
0.0372043 413.6611894
0.0378472 414.8681709
0.0385546 416.1906884
0.0392255 417.3415264
0.0399248 418.5472266
0.040638 419.8675218
0.0413794 421.1044687
0.0420413 422.2342898
0.0427673 423.4813336
0.0434856 424.6838703
0.0442322 425.8905142
0.0449853 427.0461093
0.0457666 428.3366653
0.0465472 429.571095
0.0473773 430.7991426
0.0481852 432.0634464
0.0489925 433.2945728
0.0497849 434.4462976
0.0505909 435.6665243
0.0514177 436.8753823
0.0522722 438.0759893
0.0531402 439.3485869
0.0540501 440.5908523
0.0549876 441.8651572
0.0558816 443.0725177
0.0567465 444.2475693
0.0577664 445.5368083
0.0586792 446.7421777
0.0596971 448.0410667
0.0606505 449.2430022
0.0618004 450.6289663
0.0628222 451.9117108
0.0639204 453.2066926
0.0649611 454.4522626
0.0661692 455.8595648
0.0672567 457.0828786
0.068378 458.3559477
0.0695471 459.6575195
0.0707077 460.8943358
0.0718042 462.1166456
0.0730599 463.3954689
0.0743279 464.7633024
0.0756639 466.0673744
0.0769911 467.4337459
0.078379 468.7913437
0.0796611 470.0782453
0.0810799 471.3898172
0.0823516 472.6466045
0.0837734 473.8899926
0.0851864 475.231911
0.0866248 476.5288612
0.0880887 477.8254105
0.0895984 479.1587411
0.0911949 480.5016296
0.0926316 481.7728011
0.0942505 483.1148949
0.0959009 484.4543995
0.0975286 485.7672542
0.0992615 487.1133208
0.1010934 488.5851527
0.1029148 489.997929
0.1046393 491.3010719
0.1064749 492.6531409
0.1082802 493.9779582
0.1100017 495.229808
0.1117337 496.4662139
0.1135894 497.770382
0.1154559 499.0247172
0.1174657 500.4425175
0.1193702 501.6827564
0.1214253 503.1235425
0.1235619 504.4723507
0.1254222 505.6690605
0.1273531 506.9133018
0.1293514 508.194742
0.1313861 509.4590275
0.1333825 510.6519654
0.135671 512.033797
0.1377573 513.3476526
0.1401601 514.7379184
0.1422822 515.9720669
0.1446084 517.3066097
0.146703 518.4561311
0.1490707 519.8116256
0.1514327 521.1397945
0.1534487 522.2649286
0.1556652 523.4612169
0.1579477 524.6363023
0.1602889 525.9094509
0.1624717 527.068036

[ 本帖最后由 Edwinlr 于 2009-4-17 18:06 编辑 ]

Edwinlr 发表于 2009-4-17 18:08

拟合函数为y =s-(s-312)*exp(-m*x^n);

Edwinlr 发表于 2009-4-19 11:07

...

谁能帮我下...

dingd 发表于 2009-4-20 11:26

这次的结果好像还行:
均方差(RMSE): 4.882262414652
残差平方和(RSS): 3885.34726454034
相关系数(R): 0.998030454894973
相关系数之平方(R^2): 0.996064788897867
决定系数(DC): 0.9935371926897
卡方系数(Chi-Square): 5.22804888645596
F统计(F-Statistic): 12378.5216174562
约束条件: 527.068036-(s-(s-312)*exp(-m*0.1624717^n)) = -2.847360747E-7
          529.2-(-(s-312)*exp(-m*0.1624717^n)*(-m*n*0.1624717^(n-1))) = -3.119832854E-7

参数        最佳估算
----------        -------------
m                  5.06326805573526
n                  0.782705970209716
s                  617.03788300834
页: [1]
查看完整版本: dingd主任请进