24小时热门版块排行榜    

查看: 2121  |  回复: 5

715211229

木虫 (正式写手)

[求助] matlab拟合公式中未知系数

现在有2组数据,比较大,不方便贴出来,所以放附件了。
拟合给定的这2 个情况中f(x)中的系数ai。这个是我拟合的,效果不好,初值不知道该怎么调。

5、高速凸轮进气门上升段
f(x) = a6*(x^24)+a5*(x^22)+a4*(x^16)+a3*(x^12)+a2*(x^6)+a1*(x^2)+a0

       a0 =       5.675  (5.669, 5.68)
       a1 =      -9.946  (-9.978, -9.915)
       a2 =        6.59  (6.513, 6.667)
       a3 =       -3.32  (-3.421, -3.219)
       a4 =        1.42  (1.357, 1.482)
       a5 =     -0.2558  (-0.272, -0.2396)
       a6 =     0.08181  (0.07615, 0.08747)

6、高速凸轮进气门下降段  (效果不好)

       f(x) = a6*(x^26)+a5*(x^22)+a4*(x^20)+a3*(x^18)+a2*(x^5)+a1*(x^2)+a0

       a0 =       5.674  (5.625, 5.723)
       a1 =      -16.34  (-16.67, -16.01)
       a2 =       15.89  (15.25, 16.52)
       a3 =      -66.16  (-73.4, -58.92)
       a4 =         110  (97.04, 123)
       a5 =      -52.58  (-59.2, -45.96)
       a6 =       3.717  (3.193, 4.24)


[ Last edited by 715211229 on 2011-12-23 at 12:13 ]
回复此楼

» 本帖附件资源列表

  • 欢迎监督和反馈:小木虫仅提供交流平台,不对该内容负责。
    本内容由用户自主发布,如果其内容涉及到知识产权问题,其责任在于用户本人,如对版权有异议,请联系邮箱:xiaomuchong@tal.com
  • 附件 1 : 数据.rar
  • 2011-12-23 12:12:11, 4.31 K

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

我是蜗牛
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
回帖置顶 ( 共有1个 )

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

感谢参与,应助指数 +1
715211229(金币+4): ★★★★★最佳答案 嗯,多谢了 2011-12-24 12:40:57
715211229: 回帖置顶 2011-12-24 12:41:03
如果要平滑部分 误差小可改变权重,但是总是不会理想
  x=x4;y=h4;
w=1./(y+0.00001);
opts=fitoptions('method','NonlinearLeastSquares','Weights',(w).^(1),'Lower',[0 -Inf 0 -Inf 0  -Inf 0],'Upper',[Inf 0 Inf 0 Inf 0 Inf]);
opts.StartPoint= [ 3.7168  -52.5824  110.0003  -66.1606   15.8861  -16.3403    5.6742];
ft_ = fittype('a6*(x^26)+a5*(x^22)+a4*(x^20)+a3*(x^18)+a2*(x^5)+a1*(x^2)+a0','dependent',{'y'},...
    'independent',{'x'},'coefficients',{'a6', 'a5','a4','a3','a2','a1','a0'},'options',opts);
[cf_,good]= fit(x,y,ft_)
plot(x,cf_(x),'r-',x, y, 'b-');
legend('拟合图','原始数据')

cf_ =

     General model:
     cf_(x) = a6*(x^26)+a5*(x^22)+a4*(x^20)+a3*(x^18)+a2*(x^5)+a1*(x^2)+a0
     Coefficients (with 95% confidence bounds):
       a6 =      0.9442  (0.8139, 1.075)
       a5 =      -15.29  (-17.22, -13.36)
       a4 =       34.43  (30.31, 38.54)
       a3 =      -22.39  (-24.91, -19.87)
       a2 =       10.39  (9.83, 10.94)
       a1 =       -13.1  (-13.56, -12.64)
       a0 =       5.229  (5.102, 5.355)

good =

           sse: 7.3790
       rsquare: 0.9793
           dfe: 171
    adjrsquare: 0.9785
          rmse: 0.2077


The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
6楼2011-12-24 11:28:32
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通回帖

dbb627

荣誉版主 (著名写手)

一定要选你的公式吗
Linear model Poly9:
     f(x) = p1*x^9 + p2*x^8 + p3*x^7 + p4*x^6 +
                    p5*x^5 + p6*x^4 + p7*x^3 + p8*x^2 + p9*x + p10
Coefficients (with 95% confidence bounds):
       p1 =       2.661  (-3.745, 9.066)
       p2 =      -40.35  (-80.31, -0.3958)
       p3 =       196.5  (91.87, 301.1)
       p4 =        -447  (-596.2, -297.8)
       p5 =         526  (400.1, 652)
       p6 =      -319.1  (-383, -255.1)
       p7 =       99.43  (80.45, 118.4)
       p8 =      -24.38  (-27.42, -21.34)
       p9 =      0.7499  (0.5288, 0.971)
       p10 =       5.671  (5.666, 5.677)

Goodness of fit:
  SSE: 0.003105
  R-square: 1
  Adjusted R-square: 1
  RMSE: 0.00413

Linear model Poly9:
     f(x) = p1*x^9 + p2*x^8 + p3*x^7 + p4*x^6 +
                    p5*x^5 + p6*x^4 + p7*x^3 + p8*x^2 + p9*x + p10
Coefficients (with 95% confidence bounds):
       p1 =       396.8  (308.6, 485)
       p2 =       -2180  (-2675, -1684)
       p3 =        4874  (3706, 6042)
       p4 =       -5600  (-7100, -4100)
       p5 =        3365  (2225, 4506)
       p6 =      -888.2  (-1410, -366.8)
       p7 =        18.5  (-120.8, 157.8)
       p8 =       9.332  (-10.71, 29.38)
       p9 =      -2.033  (-3.344, -0.721)
       p10 =       5.711  (5.683, 5.739)

Goodness of fit:
  SSE: 0.07685
  R-square: 0.9999
  Adjusted R-square: 0.9999
  RMSE: 0.02139


The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
2楼2011-12-23 15:09:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dingd

铁杆木虫 (职业作家)

【答案】应助回帖

感谢参与,应助指数 +1
715211229(金币+1): 有帮助 嗯,是的,用多项式拟合可以拟合的很好,只是这个问题给定了方程,所以有点别扭 2011-12-23 20:05:44
就原数据和模型公式而言,除非改变公式,一楼的结果应该就是最好的了。
3楼2011-12-23 16:05:27
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

715211229

木虫 (正式写手)

引用回帖:
2楼: Originally posted by dbb627 at 2011-12-23 15:09:47:
一定要选你的公式吗
Linear model Poly9:
     f(x) = p1*x^9 + p2*x^8 + p3*x^7 + p4*x^6 +
                    p5*x^5 + p6*x^4 + p7*x^3 + p8*x^2 + p9*x + p10
Coefficients (with 95% confidence boun ...

是的,求给定公式的系数
我是蜗牛
4楼2011-12-23 20:03:48
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

引用回帖:
4楼: Originally posted by 715211229 at 2011-12-23 20:03:48:
是的,求给定公式的系数

第一个不用在改了,第二个加了权重
CODE:
>>  x=x4;y=h4;
w=1./(y+0.00001);
opts=fitoptions('method','NonlinearLeastSquares','Weights',(w).^(1/8),'Lower',[-Inf -Inf -Inf -Inf -Inf  -Inf -Inf],'Upper',[Inf Inf Inf Inf Inf Inf Inf]);
opts.StartPoint= [ 3.7168  -52.5824  110.0003  -66.1606   15.8861  -16.3403    5.6742];
ft_ = fittype('a6*(x^26)+a5*(x^22)+a4*(x^20)+a3*(x^18)+a2*(x^5)+a1*(x^2)+a0','dependent',{'y'},...
    'independent',{'x'},'coefficients',{'a6', 'a5','a4','a3','a2','a1','a0'},'options',opts);
[cf_,good]= fit(x,y,ft_)
plot(x,cf_(x),'or-',x, y, '* ');
legend('拟合图','原始数据')

cf_ =

     General model:
     cf_(x) = a6*(x^26)+a5*(x^22)+a4*(x^20)+a3*(x^18)+a2*(x^5)+a1*(x^2)+a0
     Coefficients (with 95% confidence bounds):
       a6 =       3.132  (2.697, 3.568)
       a5 =      -45.17  (-50.8, -39.54)
       a4 =       95.47  (84.3, 106.6)
       a3 =      -58.04  (-64.36, -51.72)
       a2 =        15.2  (14.57, 15.83)
       a1 =      -16.02  (-16.37, -15.67)
       a0 =       5.646  (5.59, 5.701)

good =

           sse: 4.3743
       rsquare: 0.9945
           dfe: 171
    adjrsquare: 0.9943
          rmse: 0.1599


The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
5楼2011-12-24 11:02:12
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 715211229 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 326求调剂 +3 上岸的小葡 2026-03-15 4/200 2026-03-15 18:50 by 无际的草原
[考研] 311求调剂 +5 冬十三 2026-03-15 5/250 2026-03-15 18:38 by 无际的草原
[考研] 289求调剂 +5 步川酷紫123 2026-03-11 5/250 2026-03-15 00:45 by kruisytel
[考研] 211本,11408一志愿中科院277分,曾在中科院自动化所实习 +3 Losir 2026-03-12 3/150 2026-03-14 12:11 by 热情沙漠
[考研] 学硕285求调剂 +13 Wisjxn 2026-03-12 46/2300 2026-03-14 10:33 by JourneyLucky
[考研] 求调剂 +3 清风问长安 2026-03-09 3/150 2026-03-14 02:15 by JourneyLucky
[考研] 一志愿天津大学,英一数二305分求调剂,四六级已过 +8 小小番的茄 2026-03-09 8/400 2026-03-14 01:53 by JourneyLucky
[考研] 295复试调剂 +5 简木ChuFront 2026-03-09 5/250 2026-03-14 01:29 by JourneyLucky
[考研] 一志愿华中农业大学071010,总分三百二,求调剂 +3 困困困困坤坤 2026-03-10 3/150 2026-03-14 00:35 by JourneyLucky
[考研] 308求调剂 +3 是Lupa啊 2026-03-10 3/150 2026-03-14 00:30 by JourneyLucky
[考研] 0805,333求调剂 +3 112253525 2026-03-10 3/150 2026-03-13 23:42 by JourneyLucky
[考研] 材料与化工求调剂一志愿 985 总分 295 +8 dream…… 2026-03-12 8/400 2026-03-13 22:17 by 星空星月
[考研] 四川大学085601材料工程专硕 初试294求调剂 +4 祝我们好在冬天 2026-03-11 4/200 2026-03-13 21:39 by peike
[考研] 281求调剂 +9 Koxui 2026-03-12 11/550 2026-03-13 20:50 by Koxui
[考研] 302求调剂 +6 负心者当诛 2026-03-11 6/300 2026-03-13 16:11 by JourneyLucky
[考研] 307求调剂 +5 超级伊昂大王 2026-03-12 5/250 2026-03-13 15:56 by 棒棒球手
[考研] 285求调剂 +4 ytter 2026-03-12 4/200 2026-03-13 14:48 by jxchenghu
[考研] 304求调剂(085602一志愿985) +12 化工人999 2026-03-09 12/600 2026-03-13 12:02 by JourneyLucky
[考研] 293求调剂,一志愿陕师大生物学 +3 ??????.?.??? 2026-03-09 3/150 2026-03-11 10:02 by 学员8dgXkO
[考研] 0703化学调剂 +3 三dd. 2026-03-10 3/150 2026-03-10 15:45 by peike
信息提示
请填处理意见