- 1、本文档共5页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 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);
}
返回;
}
您可能关注的文档
- 德拉吉抛直接货币交易计划(Delagi O direct money exchange program).doc
- 心灵成长(Spiritual growth).doc
- 心理测试(Psychological test).doc
- 心系祖国,奉献青春(The heart of the motherland, dedication youth).doc
- 心理负荷的测量方法(Measurement of psychological load).doc
- 必知的知识(You must know knowledge).doc
- 心理发展的关键期(Critical period of psychological development).doc
- 微处理器控制器(mpumcu)设计 指纹传感器芯片fcd4b14 …(Microprocessor controller (mpumcu) Design fingerprint sensor chip fcd4b14...).doc
- 快消品营销方案(FMCG marketing program).doc
- 快乐小财女的理财必修课(A financial lesson for happy, small fortune women).doc
- 2024年度党员干部民主生活会班子对照检查材料.docx
- 公司党委领导班子2024年度民主生活会对照检查材料4个带头方面.docx
- 市府办(政府办)领导班子2024年民主生活会会后综合情况报告.docx
- 在2025年市司法局信息宣传工作推进会上的讲话.docx
- 在2025年全省文化旅游高质量发展推进会上的讲话.docx
- 在2025年全区工业、住建大规模设备更新推进会上的讲话.docx
- 党支部2024年组织生活会民主评议党员情况总结报告_1.docx
- 2024年度组织生活会个人对照检查剖析材料.docx
- 镇党委书记2024年度民主生活会对照检查材料1.docx
- 党支部2024年组织生活会民主评议党员情况总结报告.docx
文档评论(0)