The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin中文论坛
 Origin 中文论坛 (Chinese Origin Forum)
 自定义拟合函数编程求助

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
gll Posted - 05/26/2019 : 10:27:03 PM
您好,
请问在自定义拟合函数(dn/dt=-k1*n-k2*n^2-k3*n^3)时编译完成,无错误,但调用时会提示“未初始化的函数指针”。请问您知道这是什么原因吗?困惑好久,实在没有办法了,非常感谢。以下是我编写的代码:
void _nlsfFitODEFunc0(
// Fit Parameter(s):
double G, double k1, double k2, double k3, double ys,
// Independent Variable(s):
double x,
// Dependent Variable(s):
double& y,
// Partial Derivative(s):
double& dy_G, double& dy_k1, double& dy_k2, double& dy_k3, double& dy_ys)
{
// Beginning of editable part
NLFitContext *pCtxt = Project.GetNLFitContext();
if (pCtxt) {
static vector vT, vY;
static matrix mY;
static int nSize;
BOOL bIsNewParamValues = pCtxt->IsNewParamValues();
if (bIsNewParamValues) {
int order = 1;
StringArray saEq;
saEq.Add("G-k1*y-k2*y^2-k3*y^3");
vector vP;
vP.Add(G=1);
vP.Add(k1=1);
vP.Add(k2=1);
vP.Add(k3=1);
vector vInt;
vInt.Add(2.);
vInt.Add(12.);
int np = 100;
vector vY0;
vY0.Add(0.000000);
int method = 1;
int rk = 1;
double tol = 1.e-005;
string fileName = GetOriginPath(ORIGIN_PATH_APPS_ROOT) + "Fit ODE\\FitODE.c";
p_ocmath_ode_app p_ocmath_ode_app_fun = Project.FindFunction("ocmath_ode_app_for_fdf", fileName, true);
if (p_ocmath_ode_app_fun(order, saEq, vP, vInt, np, vY0, method, rk, tol, vT, mY) < 0) {
return;
}
mY.GetColumn(vY, 0);
}
ocmath_interpolate(&x, &y, 1, vT, vY, vT.GetSize());
}
// End of editable part
}
2   L A T E S T    R E P L I E S    (Newest First)
abufaisal6565 Posted - 10/31/2021 : 10:06:57 AM
Hi
it seems the solution is written in Chinese language!
Could you help to get the solution for the nonlinear differential equations for many state variable with respect to time such as:
dy1/dt=k1y1 +

dy1/dt= k1y5 - k2*y1y2
dy2/dt=k2*y1 - k1*y2*y3
dy3/dt=k1*y2*y3 -k3*y3
where k1, k2,k3 are parameters to be estimated based on the output against observed data which leads to optimal fitting data?
yuki_wu Posted - 05/27/2019 : 10:00:39 PM
Hi,

建议直接使用 Fit ODE App:
https://www.originlab.com/FileExchange/details.aspx?v=0&fid=500

Regards,
Yuki

OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000