-
大小: 11KB文件类型: .zip金币: 1下载: 0 次发布日期: 2021-06-15
- 语言: Matlab
- 标签: BFGS Optimization curve fitting
资源简介
自己编写的BFGS 优化算法,以及用于曲线拟合的范例,测试通过,结果和matlab非常近似。简单易用。
代码片段和文件信息
/*
@ author: luchang li luchangli1993@163.com
@ huazhong university of science and technology
@ 2017/12/07
@ free use for research
*/
#include “CurveFitting.h“
/*
exp fitting
y=a*exp(b*x)
FitPara=[ab]
*/
void ExpFit_PreFitting(float *FitPara float *ix float *iy int DataNum)
{
FitPara[0] = iy[0];
FitPara[1] = logf(iy[1] / iy[0]);
}
float ExpFit_TargerF(float *FitPara float *ix float *iy int DataNum)
{
float a = FitPara[0];
float b = FitPara[1];
float y0;
int cnt = 0;
float SquareError = 0;
for (cnt = 0; cnt < DataNum; cnt++)
{
y0 = a*expf(b*ix[cnt]);
SquareError += powf(y0 - iy[cnt] 2);
}
return SquareError;
}
/*
Gaussian Fitting 1 0
Y=a*exp(-(x-x0)^2/(2*sigma^2))
FitPara=[Ax0sigma]
*/
void GausFit10_PreFitting(float *FitPara float *ix float *iy int DataNum)
{
float mdat = iy[0];
float mpos = 0;
int cnt = 0;
for (cnt = 0; cnt < DataNum; cnt++)
{
if (mdat < iy[cnt])
{
mdat = iy[cnt];
mpos = cnt;
}
}
FitPara[0] = mdat;
FitPara[1] = mpos;
FitPara[2] = mpos / 2.5f;
}
float GausFit10_TargerF(float *FitPara float *ix float *iy int DataNum)
{
float a = FitPara[0];
float x0 = FitPara[1];
float sigma = FitPara[2];
float y0;
int cnt = 0;
float SquareError = 0;
for (cnt = 0; cnt < DataNum; cnt++)
{
y0 = a*expf(-(ix[cnt] - x0)*(ix[cnt] - x0) / (2 * sigma*sigma));
SquareError += powf(y0 - iy[cnt] 2);
}
return SquareError;
}
/*
Gaussian Fitting 1 1
Y=a*exp(-(x-x0)^2/(2*sigma^2))+b
FitPara=[Ax0sigmab]
*/
void GausFit11_PreFitting(float *FitPara float *ix float *iy int DataNum)
{
float mdat = iy[0];
float mpos = 0;
int cnt = 0;
for (cnt = 0; cnt < DataNum; cnt++)
{
if (mdat < iy[cnt])
{
mdat = iy[cnt];
mpos = cnt;
}
}
float b = Min(iy[0] iy[DataNum - 1]);
FitPara[0] = mdat - b;
FitPara[1] = mpos;
FitPara[2] = mpos / 2.5f;
FitPara[3] = b;
}
float GausFit11_TargerF(float *FitPara float *ix float *iy int DataNum)
{
float a = FitPara[0];
float x0 = FitPara[1];
float sigma = FitPara[2];
float b = FitPara[3];
float y0;
int cnt = 0;
float SquareError = 0;
for (cnt = 0; cnt < DataNum; cnt++)
{
y0 = a*expf(-(ix[cnt] - x0)*(ix[cnt] - x0) / (2 * sigma*sigma)) + b;
SquareError += powf(y0 - iy[cnt] 2);
}
return SquareError;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-12-07 20:40 BFGS Optimization curve fitting 优化曲线拟合v1.0\
目录 0 2017-12-07 20:40 BFGS Optimization curve fitting 优化曲线拟合v1.0\BFGSOptimizer\
文件 11761 2017-12-07 20:39 BFGS Optimization curve fitting 优化曲线拟合v1.0\BFGSOptimizer\BFGSOptimizer.h
文件 4256 2017-12-07 19:16 BFGS Optimization curve fitting 优化曲线拟合v1.0\BFGSOptimizer\BFGSOptimizer.vcxproj
文件 1289 2017-12-07 19:16 BFGS Optimization curve fitting 优化曲线拟合v1.0\BFGSOptimizer\BFGSOptimizer.vcxproj.filters
文件 2448 2017-12-07 20:46 BFGS Optimization curve fitting 优化曲线拟合v1.0\BFGSOptimizer\CurveFitting.cpp
文件 1117 2017-12-07 20:25 BFGS Optimization curve fitting 优化曲线拟合v1.0\BFGSOptimizer\CurveFitting.h
文件 1338 2017-12-07 20:36 BFGS Optimization curve fitting 优化曲线拟合v1.0\BFGSOptimizer\main.cpp
文件 985 2017-12-07 10:52 BFGS Optimization curve fitting 优化曲线拟合v1.0\BFGSOptimizer.sln
文件 23552 2017-12-07 20:40 BFGS Optimization curve fitting 优化曲线拟合v1.0\BFGSOptimizer.v12.suo
相关资源
- 优化方法:最速下降、阻尼牛顿、共
- bfgs算法-matlab源程序
- matlab编写的LBFGS优化算法
- 凸优化公开课convex optimization,Boyd等著
- BFGS+DFP+SUMT——matlab源程序一例
- L-BFGS的MATLAB代码208770
- Bacteria Foraging Optimization 多头菌算法
- Dubins curve for matlab
- 第三代小波变换curvelet
- 多变量函数优化的L-BFGS算法matlab程序
- 混合整数规划问题matlab仿真代码.txt
- matlab GUI 画三次B样条
- Chicken Swarm Optimization鸡群优化算法和
- 2014年最新提出的仿生群智能优化算法
- 本程序是拟牛顿法-bfgs算法的matlab代码
- 《SeDuMi — 基于matlab的优化软件》帮助
- 数据拟合Matlab程序
- matlab_FR共轭梯度算法+BFGS拟牛顿算法
- V-CURVE选取正则化参数
- l-bfgs的matlab代码
- minFunc_2012 一个最优化的Matlab工具箱
- Genetic optimization of C clustering 运用遗传
- PSOGSA_v3
- 人工蜂群算法优化无刷直流电机PID控
- 改进后的离散粒子群算法 (discrete
- Particle Swarm Optimization(PSO) Algorithm
- matlab编写的BFGS优化算法程序
- curveshadding matlab中画阴影区域
- 猫群群算法解决优化问题 (cat optim
- 磷虾群优化算法 (Krill herd optimizati
评论
共有 条评论