24小时热门版块排行榜    

查看: 2122  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] NSFC申报书里申请人简历中代表性论著还需要在申报书最后的附件里面再上传一遍吗 20+5 NSFC2026我来了 2026-03-10 14/700 2026-03-15 23:53 by 不负韶华的虎
[考研] 化学调剂0703 +7 啊我我的 2026-03-11 7/350 2026-03-15 23:03 by 凌千颂111
[基金申请] 国自科面上基金字体 +4 iwuli 2026-03-12 5/250 2026-03-15 17:07 by 风云无泪
[考研] 267一志愿南京工业大学0817化工求调剂 +5 SUICHILD 2026-03-12 5/250 2026-03-14 14:53 by jean5056
[考研] 290求调剂 +4 @将就将就看 2026-03-10 8/400 2026-03-14 14:23 by 千千运气
[考研] 211本,11408一志愿中科院277分,曾在中科院自动化所实习 +3 Losir 2026-03-12 3/150 2026-03-14 12:11 by 热情沙漠
[考研] 266求调剂 +4 学员97LZgn 2026-03-13 4/200 2026-03-14 08:37 by zhukairuo
[考研] 313分生物学求调剂 +6 Yyt杨1 2026-03-09 8/400 2026-03-14 03:00 by JourneyLucky
[考研] 求调剂 +3 清风问长安 2026-03-09 3/150 2026-03-14 02:15 by JourneyLucky
[考研] 2026考研调剂+本科延边大学+山东大学+生物化学与分子生物学+有项目经验 +3 ccdsscjy 2026-03-09 6/300 2026-03-14 02:14 by JourneyLucky
[考研] 云南财经大学信息学院计算机学硕专硕学位点 +3 zjptai 2026-03-10 5/250 2026-03-14 01:23 by 飞行琦
[考研] 0703求调剂 +7 jtyq001 2026-03-10 7/350 2026-03-14 01:06 by JourneyLucky
[考研] 一志愿湖师大化学289求调剂 +6 XMCMM3.14159 2026-03-10 6/300 2026-03-14 00:28 by JourneyLucky
[考研] 285 求调剂 资源与环境 一志愿北京化工大学 +3 未名考生 2026-03-10 3/150 2026-03-13 23:04 by JourneyLucky
[考研] 285化工学硕求调剂(081700) +6 柴郡猫_ 2026-03-12 6/300 2026-03-13 20:46 by hmn_wj
[考研] 311求调剂 +3 冬十三 2026-03-13 3/150 2026-03-13 20:41 by JourneyLucky
[考研] 295求调剂 +3 小匕仔汁 2026-03-12 3/150 2026-03-13 15:17 by vgtyfty
[论文投稿] 投稿问题 5+4 星光灿烂xt 2026-03-12 6/300 2026-03-13 14:17 by god_tian
[考博] 26申博求助 +3 跳跃饼干 2026-03-10 4/200 2026-03-10 21:15 by Tntcnn
[考研] 一志愿:武汉理工,材料工程,英二数二 总分314 +3 2202020125 2026-03-10 4/200 2026-03-10 13:54 by xiongyaxuan
信息提示
请填处理意见