24小时热门版块排行榜    

查看: 1432  |  回复: 1

agnes7777

银虫 (初入文坛)

[求助] 请教大家使用 OriginLab 做Fitting with Convolution 无法Fitting with compiling 已有1人参与

   跟着https://www.originlab.com/doc/Tutorials/Fitting-Convolution Fitting with Convolution把代码拷入后, 提示错误

Linking...
Done!
compiling...
_nlfFitConv.fit
.......TMP\OriginC\NLSF\_nlfFitConv.fit(42) :Error, Member's access requires struct/class type.
.......TMP\OriginC\NLSF\_nlfFitConv.fit(42) :Error, error(s) found in compiling method
.......TMP\OriginC\NLSF\_nlfFitConv.fit(42) :Error, general compile error
.......TMP\OriginC\NLSF\_nlfFitConv.fit(29) :Error, error(s) found in compiling function _nlsfFitConv


Compile Failed!

求大神帮忙 谢谢

---------------------------------------------
CODE:
   #pragma warning(error : 15618)
#include <origin.h>
// Header files need to be included
#include <ONLSF.H>
#include <fft_utils.h>
//
//
void _nlsfTestConv(
// Fit Parameter(s):
double y0, double A, double t,
// Independent Variable(s):
double x,
// Dependent Variable(s):
double& y)
{
        // Beginning of editable part       
        NLFitContext *pCtxt = Project.GetNLFitContext();
        Worksheet wks;
        DataRange dr;
        int c1,c2;
        dr = pCtxt->GetSourceDataRange(); //Get the source data range
        dr.GetRange(wks, c1, c2);  //Get the source data worksheet
        if ( pCtxt )
        {       
                // Vector for the output signal in each iteration.
                static vector vSignal;
                // If parameters were updated, we will recalculate the convolution result.
                BOOL bIsNewParamValues = pCtxt->IsNewParamValues();
                if ( bIsNewParamValues )
                {
                        // Read sampling and response data from worksheet.
                        Dataset dsSampling(wks, 0);
                        Dataset dsResponse(wks, 2);
                        int iSize = dsSampling.GetSize();
                       
                        vector vResponse, vSample;
                       
                        vResponse = dsResponse;
                        vSample = dsSampling;

                        vSignal.SetSize(iSize);
                        vResponse.SetSize(iSize);
                        vSample.SetSize(iSize);
                       
                        // Compute the exponential decay curve
                        vSignal = A * exp( -t*vSample );
                        // Perform convolution
                        int iRet = fft_fft_convolution(iSize, vSignal, vResponse);
                        //Correct the convolution by multiplying the sampling interval
                        vSignal = (vSample[1]-vSample[0])*vSignal;

       
                }
               
                NLSFCURRINFO    stCurrInfo;
                pCtxt->GetFitCurrInfo(&stCurrInfo);
                // Get the data index for the iteration
                int nCurrentIndex = stCurrInfo.nCurrDataIndex;
                // Get the evaluated y value
                y = vSignal[nCurrentIndex] + y0;
                // For compile the function, since we haven't use x here.
                x;
        }
        // End of editable part
}

[ Last edited by jjdg on 2018-2-19 at 08:48 ]
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dingd

铁杆木虫 (职业作家)

【答案】应助回帖


感谢参与,应助指数 +1
jjdg: 金币+1, 感谢参与 2018-02-19 08:48:14
拟合问题推荐换用1stOpt,比Origin易用,效果也更好。
2楼2018-02-17 10:08:35
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 agnes7777 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[论文投稿] 售SCI一区文章,我:8.O.55.1.O.54,科目齐全,可伽急 +3 Vi50GxzrFcSG 2026-08-07 6/300 2026-08-08 15:07 by oEVWOejN9taj
[论文投稿] 售SCI一区T0P文章,我:8.O.55.1.O.54,科目齐全,可+急 +3 WQyTGMbfH7Cx 2026-08-07 4/200 2026-08-08 15:02 by oEVWOejN9taj
[基金申请] fileCode有新解读? +9 Tide man 2026-08-08 17/850 2026-08-08 14:56 by archvillain
[基金申请] 售SCI一区文章,我:8.O.55.1.O.54,科目齐全,可伽急 +3 HEQlVqMTIA7d 2026-08-07 4/200 2026-08-08 14:27 by oEVWOejN9taj
[基金申请] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +4 KXLV3nuBVBY7 2026-08-07 5/250 2026-08-08 14:07 by oEVWOejN9taj
[基金申请] 国基金的申报应该改成非等额制,评价高的钱多评价低的钱少,但是增加资助率 +5 a089 2026-08-07 5/250 2026-08-08 14:04 by alian_214
[论文投稿] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +3 KXLV3nuBVBY7 2026-08-07 6/300 2026-08-08 14:01 by oEVWOejN9taj
[基金申请] 关于filecode +4 布布和一二 2026-08-07 7/350 2026-08-07 22:55 by zhanghaozhu
[基金申请] 化学口download_prp&amp;fileCode的固定段好像这几天一直没变,有变的大神么? +3 Tide man 2026-08-07 4/200 2026-08-07 22:39 by Tide man
[基金申请] 固定端突然变了,今天 +6 archvillain 2026-08-06 10/500 2026-08-07 16:03 by 医学老男孩
[基金申请] 听说今天filecode变了 +24 布布和一二 2026-08-06 47/2350 2026-08-07 16:02 by zhiyanjiang
[基金申请] filecode与中标关系的预测 +3 布布和一二 2026-08-07 3/150 2026-08-07 15:09 by gltch
[基金申请] filecode变化情况 +6 布布和一二 2026-08-07 22/1100 2026-08-07 14:45 by 且听虎啸
[基金申请] filecode +14 等待解的谜 2026-08-06 19/950 2026-08-07 12:20 by wlwhappy
[基金申请] 求各位大神看下 100+6 hpkpkpkp 2026-08-05 33/1650 2026-08-06 14:49 by zhiyanjiang
[基金申请] 影响面上的因素 +8 布布和一二 2026-08-05 11/550 2026-08-06 10:41 by 宝贝虫子
[基金申请] 8月时间戳变的,举个手。玩一下,释放压力 +9 archvillain 2026-08-04 11/550 2026-08-05 20:06 by wlwhappy
[考博] 【2027博士申请】纳米药物递送方向 20+3 13586093586 2026-08-03 4/200 2026-08-05 09:59 by lfy8008
[基金申请] 纯娱乐,不喜欢勿喷 +7 Tide man 2026-08-04 10/500 2026-08-04 15:10 by loufangrui
[基金申请] 什么时候能放榜呀? +3 Jacob678 2026-08-03 3/150 2026-08-03 16:14 by gltch
信息提示
请填处理意见