24小时热门版块排行榜    

Znn3bq.jpeg
查看: 1368  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 调剂求收留 +34 果然有我 2026-04-10 35/1750 2026-04-15 13:05 by 西北望—风沙
[考研] 化学070300 求调剂 +23 哈哈哈^_^ 2026-04-12 23/1150 2026-04-14 16:30 by zhouxiaoyu
[考研] 366求调剂 +11 不知名的小卅 2026-04-11 11/550 2026-04-14 15:50 by zs92450
[考研] 279求调剂 +12 张番茄不炒蛋 2026-04-11 12/600 2026-04-14 15:38 by zs92450
[考研] 085408光电信息工程专硕355一志愿长春光机所调剂 +6 王ymaa 2026-04-13 13/650 2026-04-14 11:33 by 王ymaa
[考研] 材料085601调剂 +32 何润采123 2026-04-10 34/1700 2026-04-14 08:47 by 木木mumu~
[考研] 机械还有还有名额吗?太难了 +8 笑笑袁 2026-04-10 8/400 2026-04-14 08:44 by screening
[考研] 一志愿双非085400电子信息344 求调剂,对材料和化学方向也感兴趣 +12 无情的小羊 2026-04-09 13/650 2026-04-13 14:17 by 张zhihao
[考研] 一志愿085802 323分求调剂 +13 drizzle_9 2026-04-12 14/700 2026-04-13 10:26 by Faiz5552
[考研] 一志愿华中农微生物,288分,三年实验经历 +11 代fish 2026-04-09 11/550 2026-04-12 10:21 by Hayaay
[考研] 一志愿西北工业大学289 085602 +33 yang婷 2026-04-10 34/1700 2026-04-12 08:11 by Art1977
[考研] 材料与化工300求调剂 +39 肖开文 2026-04-09 43/2150 2026-04-12 01:30 by 秋豆菜芽
[考研] 086003调剂求助 +21 苏弋万 2026-04-09 22/1100 2026-04-11 20:25 by dongdian1
[考研] 调剂 +5 文道星台 2026-04-11 5/250 2026-04-11 15:01 by 凯凯要变帅
[考研] 调剂 +12 卷卷卷心菜_ 2026-04-09 13/650 2026-04-10 22:36 by Ftglcn90
[考研] 263能源动力专硕求调剂 +4 加大号饭盒袋 2026-04-10 4/200 2026-04-10 20:52 by gong120082
[考研] 本9 一志愿西工大085601 324求调剂 +5 wysyjs25 2026-04-10 5/250 2026-04-10 16:57 by luoyongfeng
[考研] 机械专368 有去处吗 +4 种大树 2026-04-10 4/200 2026-04-10 15:31 by jiajinhpu
[考研] 086004 求调剂 309 +7 Yin DY 2026-04-08 7/350 2026-04-09 13:59 by Delta2012
[考研] 求调剂 +3 猪肉墩粉条cc 2026-04-08 4/200 2026-04-09 10:05 by 猪肉墩粉条cc
信息提示
请填处理意见