网站大量收购独家精品文档,联系QQ:2885784924

最小二乘法曲线拟合代码(Least squares curve fitting code).doc

最小二乘法曲线拟合代码(Least squares curve fitting code).doc

  1. 1、本文档共5页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
最小二乘法曲线拟合代码(Least squares curve fitting code)

最小二乘法曲线拟合代码(Least squares curve fitting code) / / the least squares curve fitting //x double precision solid one-dimensional array, length of N, store a given n data points, x coordinates //y double precision solid one-dimensional array, length of N, store a given n data points, y coordinates //n shaping variables, the number of data points given //a double precision real one-dimensional array, length m, return m - 1 times the M coefficients of the polynomial //m the number of integer variables and polynomial, m20 and m n. //dt double precision real one-dimensional array, length 3, dt[0], return the sum of pseudo polynomial and data point error sum //dt[1] returns the sum of the absolute values of the pseudo polynomial and the data point error, and dt[2] returns the maximum of the absolute value of the pseudo polynomial and the data point error #include math.h Void, hpir1 (double, *x, double, *y, int, N, double, *a, int, m, double, *dt) Int / N, m; X[] y[] / / double, a[], dt[]; {int, I, J, k; Double, Z, P, C, G, Q, D1, D2, s[20], t[20], b[20]; For (i=0; i=m-1; i++) a[i]=0.0; If (mn) m=n; If (m20) m=20; Z=0.0; For (i=0; i=n-1; i++) z=z+x[i]/ (1.0*n); B[0]=1.0; d1=1.0*n; p=0.0; c=0.0; For (i=0; i=n-1; i++) {p=p+ (x[i]-z); c=c+y[i];} C=c/d1; p=p/d1; A[0]=c*b[0]; If (m1) {t[1]=1.0; t[0]=-p; D2=0.0; c=0.0; g=0.0; For (i=0; i=n-1; i++) {q=x[i]-z-p; d2=d2+q*q; C=c+y[i]*q; G=g+ (x[i]-z) *q*q; } C=c/d2; p=g/d2; q=d2/d1; D1=d2; A[1]=c*t[1]; a[0]=c*t[0]+a[0]; } For (j=2; j=m-1; j++) {s[j]=t[j-1]; S[j-1]=-p*t[j-1]+t[j-2]; If (j=3) For (k=j-2; k=1; k--) S[k]=-p*t[k]+t[k-1]-q*b[k]; S[0]=-p*t[0]-q*b[0]; 2=0;c=0;g=0; 对于(i = 0;i = n-1;i +) {; 为(k = J-1;K>=0;K) q = q(x [ i - z ]); q=q; G=(x,i)- q; } C = D2; D1=D2; a; 为(k = J-1;K>=0;K) {; b; } } dt [ 0 ] = 0;dt [ 1 ] = 0;dt [ 2 ] = 0; 对于(i = 0;i = n-1;i +) { Q =一个[ 1 ]; 为(k = m-2;K>=0;K) q =(q); P = q-y [我]; 如果(晶圆厂(P) DT [ 2 ] [ 2 ])DT =晶圆厂(P); dt [ 0 ] = dt [ 0 ] + P * P; DT [ 1 ] = dt [ 1 ] +工厂(P); } 返回; }

您可能关注的文档

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档