| ²é¿´: 1675 | »Ø¸´: 3 | ||||
wsbl½ð³æ (СÓÐÃûÆø)
|
[½»Á÷]
Levenberg-Marquardt Ëã·¨µÄÀý×Ó´úÂë ÒÑÓÐ3È˲ÎÓë
|
|
#include "stdio.h" #include #include void out(double*p,int n,int m)//Êä³ö¾ØÕó {int i,j; for (i=0;i if ((m*i+j)%m==0) printf("\n" ;printf("%16.8f",*(p+m*i+j)); } printf("\n\n" ;} void LM(double *c, double *sigma, int N, double sigma_H2O,double r[3]) { int i,j,maxtime=100; //Èç¹û²»ÊÕÁ²£¬ÔÊÐíµÄ×î´óµü´ú´ÎÊý double s,snext,det,temp0; double x[]={.5,.5},xnext[2],ep[2]; double f[6]; double f_x1[6]; double f_x2[6]; double m[4]; //¾ØÕó double temp1[4];//Äæ¾ØÕó double temp2[2]; double temp3[2]; double alph,beita; j=0; for (i=0;i f_x1=sigma_H2O*log(1+c/x[1]); f_x2=-sigma_H2O*x[0]*c/(x[1]*x[1])/(1+c/x[1]); } s=.0; for (i=0;i temp0=.0; for (i=0;i m[0]=temp0; temp0=.0; for (i=0;i m[1]=temp0; m[2]=temp0; temp0=.0; for (i=0;i m[3]=temp0; //out(m,2,2);//µ½´Ë²½ÕýÈ·¡£ alph=(fabs(*m)+fabs(*(m+3)))/2; //printf("%8.5e\n",alph); beita=2.0; m[0]=m[0]+alph; m[3]=m[3]+alph; //out(m,2,2);//µ½´Ë²½ÕýÈ·¡£ det=1.0/(m[0]*m[3]-m[1]*m[2]); //printf("µü%15.10f\n",det); temp1[0]=det*m[3]; temp1[1]=-det*m[1]; temp1[2]=-det*m[1]; temp1[3]=det*m[0]; //out(temp1,2,2);//µ½´Ë²½ÕýÈ·¡£ //temp2=mult(temp,f,2,N,1); temp0=.0; for (i=0;i temp2[0]=temp0; temp0=.0; for (i=0;i temp2[1]=temp0; //out(temp2,2,1);//µ½´Ë²½ÕýÈ·¡£ //temp3=mult(temp1,temp2,2,2,1); temp0=.0; for (i=0;i<2;i++) { temp0=temp0+temp1*temp2; } temp3[0]=temp0; temp0=.0; for (i=0;i<2;i++) { temp0=temp0+temp1[2+i]*temp2; } temp3[1]=temp0; //out(temp3,2,1);//µ½´Ë²½ÕýÈ·¡£ xnext[0]=x[0]-temp3[0]; xnext[1]=x[1]-temp3[1]; //out(xnext,2,1);//µ½´Ë²½ÕýÈ·¡£ snext=0; for (i=0;i snext=snext+f*f; } //printf("%8.5e",snext);//µ½´Ë²½ÕýÈ·¡£ ep[0]=xnext[0]-x[0]; ep[1]=xnext[1]-x[1]; //out(ep,2,1);//µ½´Ë²½ÕýÈ·¡£ while (((fabs(ep[0])+fabs(ep[1]))/2)>1.0e-6 && j if (snext>=s) alph=alph*beita; else alph=alph/beita; //printf("%8.3f\n",(float)j); x[0]=xnext[0]; x[1]=xnext[1]; s=snext; for (i=0;i f_x1=sigma_H2O*log(1+c/x[1]); f_x2=-sigma_H2O*x[0]*c/(x[1]*x[1])/(1+c/x[1]); } s=.0; for (i=0;i temp0=.0; for (i=0;i m[0]=temp0; temp0=.0; for (i=0;i m[1]=temp0; m[2]=temp0; temp0=.0; for (i=0;i m[3]=temp0; m[0]=m[0]+alph; m[3]=m[3]+alph; //out(m,2,2);//µ½´Ë²½ÕýÈ·¡£ det=1.0/(m[0]*m[3]-m[1]*m[2]); //printf("µü%15.10f\n",det); temp1[0]=det*m[3]; temp1[1]=-det*m[1]; temp1[2]=-det*m[1]; temp1[3]=det*m[0]; //out(temp1,2,2);//µ½´Ë²½ÕýÈ·¡£ //temp2=mult(temp,f,2,N,1); temp0=.0; for (i=0;i temp2[0]=temp0; temp0=.0; for (i=0;i temp2[1]=temp0; //out(temp2,2,1);//µ½´Ë²½ÕýÈ·¡£ //temp3=mult(temp1,temp2,2,2,1); temp0=.0; for (i=0;i<2;i++) { temp0=temp0+temp1*temp2; } temp3[0]=temp0; temp0=.0; for (i=0;i<2;i++) { temp0=temp0+temp1[2+i]*temp2; } temp3[1]=temp0; //out(temp3,2,1);//µ½´Ë²½ÕýÈ·¡£ xnext[0]=x[0]-temp3[0]; xnext[1]=x[1]-temp3[1]; //out(xnext,2,1);//µ½´Ë²½ÕýÈ·¡£ snext=0; for (i=0;i snext=snext+f*f; } ep[0]=xnext[0]-x[0]; ep[1]=xnext[1]-x[1]; } r[0]=xnext[0]; r[1]=xnext[1]; r[2]=(double)j; } void main() { //double p[] = {0.02,0.04,0.08,0.12,0.16,0.2,0.24,0.28};//mol/L //double q[] = {0.06810,0.06442,0.0601,0.05678,0.05467,0.05237,0.05108,0.05025};//N/m double p[] = {0.02,0.04,0.08,0.12,0.16,0.2}; double q[] = {0.06810,0.0644,0.0601,0.0568,0.0547,0.0524}; double r[3]; LM(p,q,6,0.07197,r); printf("µü´ú´ÎÊý£º%5.0f\n",r[2]); if (r[2]<100) { printf("\nϣʲ¿Æ·òÄ£ÐÍsigma_H2O-sigma_H2O*a*ln(1+x/b)ÖÐ\n\n²ÎÊýaµÄ×îÓÅֵΪ:%9.9f\n",r[0]); printf("\n²ÎÊýbµÄ×îÓÅֵΪ:%9.9f\n\n",r[1]); } else printf("\nÓÃLevenberg·¨Ê§°Ü\n\n" ;for(int i=0;i<1;i++)//ÑÓʱ¼¸Ãë¡£ { printf("°´»Ø³µ¼ü½áÊø³ÌÐò:" ;getchar(); } } |
» ÊÕ¼±¾ÌûµÄÌÔÌûר¼ÍƼö
Èí¼þѧϰ |
» ²ÂÄãϲ»¶
081700£¬311£¬Çóµ÷¼Á
ÒѾÓÐ15È˻ظ´
Ò»Ö¾Ô¸±±¾©»¯¹¤085600 310·ÖÇóµ÷¼Á
ÒѾÓÐ18È˻ظ´
085600²ÄÁÏÓ뻯¹¤301·ÖÇóµ÷¼ÁԺУ
ÒѾÓÐ4È˻ظ´
²ÄÁÏÓ뻯¹¤371Çóµ÷¼Á
ÒѾÓÐ14È˻ظ´
336²ÄÁÏÓ뻯¹¤085600Çóµ÷¼Á
ÒѾÓÐ7È˻ظ´
²ÄÁÏ334Çóµ÷¼Á
ÒѾÓÐ18È˻ظ´
331Çóµ÷¼Á
ÒѾÓÐ8È˻ظ´
332Çóµ÷¼Á
ÒѾÓÐ17È˻ظ´
Ò»Ö¾Ô¸ÄϾ©º½¿Õº½Ìì´óѧ ²ÄÁÏÓ뻯¹¤329·ÖÇóµ÷¼Á
ÒѾÓÐ4È˻ظ´
²ÄÁÏר˶322
ÒѾÓÐ7È˻ظ´
» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:
Visual C++ CADÓ¦ÓóÌÐò¿ª·¢¼¼ÊõÔ´´úÂ루»ùÓÚOPenGL¼¼Êõ¿ª·¢µÄ£©
ÒѾÓÐ76È˻ظ´
Levenberg-MarquardtËã·¨ÄÜ·ñÓÃÓÚ¼ÆËã1·¶Êý¶¨ÒåϵÄ×îСֵÎÊÌ⣿
ÒѾÓÐ5È˻ظ´
Çó½âÒ»ÔªÈý´Î·½³Ì
ÒѾÓÐ8È˻ظ´
ÇóÖú£¬×Ô¼º±à´úÂëʵÏÖ±ðÈ˵ÄËã·¨£¬¿ÉÒÔÉêÇëÈí¼þÖø×÷ȨÂð
ÒѾÓÐ4È˻ظ´
ÇóÖúÉñ¾ÍøÂç ---Levenberg-MarquardtËã·¨
ÒѾÓÐ6È˻ظ´
»ùÓÚL-MËã·¨µÄBPÉñ¾ÍøÂç
ÒѾÓÐ3È˻ظ´
¡¾ÇóÖú¡¿Levenberg-Marquardt·¨ºÍLBFGSÄâÅ£¶Ù·¨£¬ÇóC++°æÔ´Â뼰ʹÓ÷½·¨
ÒѾÓÐ3È˻ظ´
¡¾ÇóÖú¡¿MATLABÖÐBPÉñ¾ÍøÂçµÄѵÁ·Ëã·¨¾ßÌåÊÇÔõôÑùµÄ£¿
ÒѾÓÐ5È˻ظ´
stockline
Ìú³æ (³õÈëÎÄ̳)
- Ó¦Öú: 0 (Ó×¶ùÔ°)
- ½ð±Ò: 144.4
- Ìû×Ó: 34
- ÔÚÏß: 18Сʱ
- ³æºÅ: 1437259
- ×¢²á: 2011-10-11
- רҵ: ¼ÆËã»úÓ¦Óü¼Êõ
2Â¥2011-10-16 07:18:24
lrs2008
ľ³æ (ÕýʽдÊÖ)
¹ÛÌì
- Ó¦Öú: 7 (Ó×¶ùÔ°)
- ½ð±Ò: 3457.1
- É¢½ð: 5505
- ºì»¨: 13
- Ìû×Ó: 424
- ÔÚÏß: 251.9Сʱ
- ³æºÅ: 746075
- ×¢²á: 2009-04-11
- ÐÔ±ð: GG
- רҵ: ¼ÆËã»úÓ¦Óü¼Êõ

3Â¥2011-10-16 09:21:30
lingshuning
ľ³æ (Ö°Òµ×÷¼Ò)
- Ó¦Öú: 89 (³õÖÐÉú)
- ½ð±Ò: 1320.9
- É¢½ð: 3426
- ºì»¨: 63
- Ìû×Ó: 3433
- ÔÚÏß: 287.6Сʱ
- ³æºÅ: 1515504
- ×¢²á: 2011-11-29
- ÐÔ±ð: GG
- רҵ: ¹¤Òµ¹¤³ÌÓë¹ÜÀí
¡ï
Сľ³æ(½ð±Ò+0.5):¸ø¸öºì°ü£¬Ð»Ð»»ØÌû
Сľ³æ(½ð±Ò+0.5):¸ø¸öºì°ü£¬Ð»Ð»»ØÌû
| ºÜÍêÕû£¬ÒªÊÇÔÙÓиö³ÌÐò×¢Ê;ÍÍêÃÀÁË£¬²»¹ý»¹ÊǶàл¥Ö÷µÄ·ÖÏí£¡ |

4Â¥2011-12-03 19:18:50














;
»Ø¸´´ËÂ¥