您好,欢迎光临本网站![请登录][注册会员]  
文件名称: 非线性最小二乘法
  所属分类: VB
  开发工具:
  文件大小: 10kb
  下载次数: 0
  上传时间: 2013-12-17
  提 供 者: huang******
 详细说明: 非线性最小二乘法数据拟合算法实现 Private Sub Command1_Click() 'PROGRAM D9R8A 'Driver for routine MRQMIN NPT = 100 MA = 6 SPREAD = 0.001 Dim X(100), Y(100), SIG(100), A(6), LISTA(6) Dim COVAR(6, 6), ALPHA(6, 6), GUES(6) A(1) = 5#: A(2) = 2#: A(3) = 3#: A(4) = 2#: A(5) = 5#: A(6) = 3# GUES(1) = 4.5: GUES(2) = 2.2: GUES(3) = 2.8 GUES(4) = 2.5: GUES(5) = 4.9: GUES(6) = 2.8 IDUM& = -911 'First try a sum of two Gaussians For I = 1 To 100 X(I) = 0.1 * I Y(I) = 0# For J = 1 To 4 Step 3 Y(I) = Y(I) + A(J) * Exp(-((X(I) - A(J + 1)) / A(J + 2)) ^ 2) Next J Y(I) = Y(I) * (1# + SPREAD * GASDEV(IDUM&)) SIG(I) = SPREAD * Y(I) Next I MFIT = MA For I = 1 To MFIT LISTA(I) = I Next I ALAMDA = -1 For I = 1 To MA A(I) = GUES(I) Next I Call MRQMIN(X(), Y(), SIG(), NPT, A(), MA, LISTA(), MFIT, COVAR(), ALPHA(), MA, CHISQ, ALAMDA) K = 1 ITST = 0 1 Print "Iteration #"; K; "Chi-squared: "; Print Format$(CHISQ, "#####.##00"); Print " ALAMDA: "; Format$(ALAMDA, ".##E+00") Print Tab(5) Print Tab(3); "A(1) A(2) A(3) A(4) A(5) A(6)" For I = 1 To MA Print Format$(A(I), "#.###0"), Next I Print Tab(5) K = K + 1 OCHISQ = CHISQ Call MRQMIN(X(), Y(), SIG(), NPT, A(), MA, LISTA(), MFIT, COVAR(), ALPHA(), MA, CHISQ, ALAMDA) If CHISQ > OCHISQ Then ITST = 0 ElseIf Abs(OCHISQ - CHISQ) < 0.1 Then ITST = ITST + 1 End If If ITST < 2 Then GoTo 1 End If ALAMDA = 0# Call MRQMIN(X(), Y(), SIG(), NPT, A(), MA, LISTA(), MFIT, COVAR(), ALPHA(), MA, CHISQ, ALAMDA) Print Tab(5); "Uncertainties:" For I = 1 To MA Print Format$(Sqr(COVAR(I, I)), "#.###0"), Next I Print Tab(5); "Expected results:" Print Tab(2); "5.0 2.0 3.0 2.0 5.0 3.0" End Sub ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: 非线性 最小二乘法
 输入关键字,在本站1000多万海量源码库中尽情搜索: