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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 NLSF.simplex
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Dominik Paulkowski

Germany
Posts

Posted - 04/18/2007 :  10:35:36 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): Origin7.5G SR6 (v7.5886)
Operating System: Windows XP

Hi there!

How can I use the simplex method in the NLSF-fitting procedure of Origin C?

I tried:
if( iFitAlgorithm == 0 ) // Default Levenberg-Marquardt method (default)
{
NLSF.Fit(iIterationsAreaFunc); // perform fit
}
else if( iFitAlgorithm == 1 ) // Simplex method (Nelder and Mead)
{
NLSF.simplex(iIterationsAreaFunc); // perform fit
}

in my fit script. NLSF.Fit(n) creates fit-data/graph with the desired NLSF.xmode = 0. But NLSF.simplex(n) do nothing.

How I have to use NLSF.simplex correctly?

Ciao,
Dominik

-------------------
:-Dipl.-Phys. Dominik Paulkowski
Fraunhofer Institute for Surface Engineering and Thin Films (IST)
Braunschweig
Germany

Mike Buess

USA
3037 Posts

Posted - 04/18/2007 :  11:35:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Dominik,

Like nlsf.iterate(), nlsf.simplex() does not create the fit curve. You need to follow nlsf.simplex(n) with nlsf.makecurve(func).

Mike Buess
Origin WebRing Member
Go to Top of Page

Dominik Paulkowski

Germany
Posts

Posted - 04/19/2007 :  03:02:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I don't know, how to use nlsf.makecurve(func). I tried:

using NLSF = LabTalk.NLSF;

// Perform nonlinear fit to plotted data
NLSF.cleanUpFitData();
NLSF.Init(); // initialize fitter

NLSF.xBegin = 1;
NLSF.xEnd = iLastFilledRow;
NLSF.xPoints= (NLSF.xEnd)-(NLSF.xBegin);
NLSF.xmode = 0; // use original x-dataset for fitfunction

NLSF.PasteToPlot = 1; // turn on pasting results to graph

NLSF.Func$ = "AreaFunctionPolynomN5"; // assign fitting function

NLSF.isBadFunc = 1; //Check the function selected for fitting: 1 = enable, 0 = disable.

NLSF.FitData$ = strYDataNameAreaFuncNanoMeter; // assign fitting dataset in a graph

// Set parameters NLSF.Pn = doubleValuen;
// ...


if( iFitAlgorithm == 0 ) // Levenberg-Marquardt method (default)
{
NLSF.Fit(iIterationenAreaFunc); // perform fit
}
else if( iFitAlgorithm == 1 ) // Nelder and Mead (Simplex) method
{
NLSF.simplex(iIterationenAreaFunc); // perform fit

wks.AddCol();
// Format new column correctly
string strLabelFitSimplex = strFitMethode + " " + strFitAlgorithm + " C0 " + strKoeffC0VarJaNein;
BOOL bDestFitSimplex = wks.Columns(iCols+1).SetLabel(strLabelFitSimplex);
Dataset colFitAreaFuncNanoMeterSimplex(wks, iCols+1);
wks.Columns(iCols+1).SetFormat(OKCOLTYPE_NUMERIC);
wks.Columns(iCols+1).SetType(OKDATAOBJ_DESIGNATION_Y);
colFitAreaFuncNanoMeterSimplex.SetSize(iRows);

string strFitXValues;
colhc.GetName(strFitXValues);
string strFitSimplexCol;
colFitAreaFuncNanoMeterSimplex.GetName(strFitSimplexCol);

NLSF.funcx$ = strFitXValues;
NLSF.funcCol$ = strFitSimplexCol;

NLSF.makecurve(func);

wks.Columns(iCols+1).SetWidth(-1);
}




// Write fit parameters to double variables
// ...

NLSF.unInit(); // Un-initialize the fitting module and free up all memory that was allocated during various fitting operations.

The error message is:
(4581) :Error, Variable "func" is not declared

What's wrong?

Ciao,
Dominik


-------------------
:-Dipl.-Phys. Dominik Paulkowski
Fraunhofer Institute for Surface Engineering and Thin Films (IST)
Braunschweig
Germany

Edited by - Dominik Paulkowski on 04/19/2007 03:04:51 AM
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 04/19/2007 :  08:22:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
In OriginC you must quote the func argument...

nlsf.makecurve("func");

Mike Buess
Origin WebRing Member
Go to Top of Page

Dominik Paulkowski

Germany
Posts

Posted - 04/20/2007 :  04:07:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot, Mike!




-------------------
:-Dipl.-Phys. Dominik Paulkowski
Fraunhofer Institute for Surface Engineering and Thin Films (IST)
Braunschweig
Germany
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000