24小时热门版块排行榜    

查看: 1585  |  回复: 10
本帖产生 1 个 程序强帖 ,点击这里进行查看
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

aimforao

禁虫 (正式写手)

本帖内容被屏蔽

» 猜你喜欢

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

已阅   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖


jjdg(金币+1, 程序强帖+1): 辛苦了 2011-11-28 01:15:06
CODE:
X=[-7.022 -2.391 0.7963 106.444 10e-4 0.365
-7.022 -2.391 0.7963 106.444 10e-3 0.479
-7.022 -2.391 0.7963 106.444 10e-2 0.592
-7.096 -2.524 1.9082 98.851  10e-4 0.427
-7.096 -2.524 1.9082 98.851  10e-3 0.575
-7.096 -2.524 1.9082 98.851  10e-2 0.711
-6.648 -2.392 1.9277 135.257 10e-4 0.595
-6.648 -2.392 1.9277 135.257 10e-3 0.701
-6.648 -2.392 1.9277 135.257 10e-2 0.891];
%====回归法==============
y= X(:,6)./(1-X(:,6));
XX=[X(:,1).*X(:,5) X(:,2).*X(:,5) X(:,3).*X(:,5) X(:,4).*X(:,5) X(:,5)];
[B,BINT,R,RINT,STATS] = REGRESS(y,XX)
rcoplot(R,RINT)
%=========最小二乘法=========
F=@(a,x)(a(1)*x(:,1)+a(2)*x(:,2)+a(3)*x(:,3)+a(4)*x(:,4)+a(5)).*x(:,5)./...
    (1+(a(1)*x(:,1)+a(2)*x(:,2)+a(3)*x(:,3)+a(4)*x(:,4)+a(5)).*x(:,5));
[par,RESNORM,RESIDUAL,EXITFLAG]= lsqcurvefit(F,rand(1,5), X(:,1:5), X(:,6))
%=====结果比较====
YY=XX*B;
Te=YY./(1+YY);
f=F(par,X(:,1:5));
plot(X(:,6),'*-');hold on;plot(Te,'ro-')
hold on;plot(f,'<-g')
legend('原数据','回归法','最小二乘')

'回归法',
Te =

    0.0151
    0.1329
    0.6052
    0.0251
    0.2049
    0.7204
    0.0770
    0.4547
    0.8929

'最小二乘'
f =

    0.0726
    0.4390
    0.8867
    0.1919
    0.7037
    0.9596
    0.5254
    0.9172
    0.9910


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-11-27 14:22:50
已阅   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 11 个回答

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★
aimforao(金币+30): 不错,这么短的时间内做出来,以后要向你学习了。 2011-11-27 13:50:12
jjdg(金币+2): 辛苦了 2011-11-27 14:12:34
引用回帖:
1楼: Originally posted by aimforao at 2011-11-27 11:23:40:
ie=(a*x1+b*x2+c*x3+d*x4+e)*x5/(1+(a*x1+b*x2+c*x3+d*x4+e)*x5);
x1     x2     x3     x4      x5    ie
-7.022 -2.391 0.7963 106.444 10e-4 0.365
-7.022 -2.391 0.7963 106.444 10e-3 0.479
-7.022 -2.3 ...

基于你的方程形式比较特殊,两种方法,回归法和最小二乘法
CODE:
X=[-7.022 -2.391 0.7963 106.444 10e-4 0.365
-7.022 -2.391 0.7963 106.444 10e-3 0.479
-7.022 -2.391 0.7963 106.444 10e-2 0.592
-7.096 -2.524 1.9082 98.851  10e-4 0.427
-7.096 -2.524 1.9082 98.851  10e-3 0.575
-7.096 -2.524 1.9082 98.851  10e-2 0.711
-6.648 -2.392 1.9277 135.257 10e-4 0.595
-6.648 -2.392 1.9277 135.257 10e-3 0.701
-6.648 -2.392 1.9277 135.257 10e-2 0.891];
%====回归法==============
y= X(:,6)./(1-X(:,6));
XX=[X(:,1).*X(:,5) X(:,2).*X(:,5) X(:,3).*X(:,5) X(:,4).*X(:,5) X(:,5)];
[B,BINT,R,RINT,STATS] = REGRESS(y,XX)
rcoplot(R,RINT)
%=========最小二乘法=========
F=@(a,x)(a(1)*x(:,1)+a(2)*x(:,2)+a(3)*x(:,3)+a(4)*x(:,4)+a(5)).*x(:,5)./...
    (1+(a(1)*x(:,1)+a(2)*x(:,2)+a(3)*x(:,3)+a(4)*x(:,4)+a(5)).*x(:,5));
[par,RESNORM,RESIDUAL,EXITFLAG]= lsqcurvefit(F,B, X(:,1:5), X(:,6))

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-11-27 13:09:07
已阅   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★
余泽成(金币+3): 谢谢参与应助! 2011-12-02 17:24:57
回归法结果
B =

   20.1351
         0
   19.7714
    1.3244
         0


BINT =

    6.9309   33.3393
         0         0
  -10.3720   49.9148
    0.4520    2.1969
         0         0


R =

    0.5595
    0.7661
   -0.0822
    0.7194
    1.0952
   -0.1167
    1.3857
    1.5106
   -0.1649


RINT =

   -2.2418    3.3607
   -1.9613    3.4934
   -0.3545    0.1901
   -2.0378    3.4766
   -1.4941    3.6846
   -0.3734    0.1400
   -1.0478    3.8193
   -0.8151    3.8363
   -0.3877    0.0579


STATS =

    0.8439   26.9497    0.0010    1.1444

最小二乘法

Local minimum possible.

lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the default value of the function tolerance.




par =

  296.9674   65.5619  306.2606   19.8283  -34.1639


RESNORM =

    0.3692


RESIDUAL =

   -0.2924
   -0.0400
    0.2947
   -0.2351
    0.1287
    0.2486
   -0.0696
    0.2162
    0.1000


EXITFLAG =

     3


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.
3楼2011-11-27 13:11:55
已阅   关注TA 给TA发消息 送TA红花 TA的回帖

aimforao

禁虫 (正式写手)

本帖内容被屏蔽

4楼2011-11-27 13:12:13
已阅   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见