From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

lev-mar fitting in diadem

Hi,

I'm completely new to DIAdem.  I'm surprised that - from what I can see - there's no Levenberg-Marquardt (or equivalent) fitting routine for parametric fitting to nonlinear functions.  Is this right?  How can I give DIAdem this functionality?  Is Xmath an option for accomplishing this task?

Nick
"You keep using that word. I do not think it means what you think it means." - Inigo Montoya
0 Kudos
Message 1 of 5
(3,517 Views)
Hi Nick,

Check out the DIAdem function ChnApprXYCalc (modul ANALYSIS -> Curve fitting -> Approximate) wich allows fitting to nonlinear functions. The function uses the Gauss method of least squares.

Christian
0 Kudos
Message 2 of 5
(3,510 Views)
Thanks Christian,

But what if I want to fit to a slightly complicated lineshape, like a Lorentzian:

(gamma/2)/(pi*((x-x0)^2+(gamma/2)^2))

where x0 is the center of the Lorentzian peak and gamma is the FWHM?

LV has a Lev-Mar fitting routine that I've used many times for Lorentzians and all sorts of functions.  From what literature I've found, I have a hunch I can use the DIAdem GPI to incorporate the routine into DIAdem.  Of course, I must first export the routine as a DLL, but that's simple.  What do you think?  Is this feasible?  I know very little about the GPI at this point.

Nick
"You keep using that word. I do not think it means what you think it means." - Inigo Montoya
0 Kudos
Message 3 of 5
(3,487 Views)

Hi Nick,

There is a GPI toolkit for add-on DIAdem DLL creation. If you have still Visual C++ 6.0 on your computer, you can also use a GPI-DLL wizard.

You find more information about GPI following this link: http://digital.ni.com/softlib.nsf/websearch/d605aa96cf81760c86256c7600742ec5

Good success!

Christian

Message 4 of 5
(3,473 Views)

Hi Nick,

It is possible to call LV DLLs from a GPI-DLL, you just need to have the LV runtime engine on that computer and also put one other file in the Windows System directory-- but I forget now which it was.  I did this 4 or 5 years ago with a Bessel Function from LabVIEW.  The GPI-DLL framework is extensive, and it's easy to get lost in it, but if you can run the GPI-DLL wizard, the boiler-plate code is super easy to create.  And if you can find the right callback function, you only need to add about 10 lines of code to call an external LV DLL.  Don't rely on the heap for memory, though, or you will limit the array size you can process-- use MAlloc just like you would in a normal C++ program.

I don't think I remember anything else,
Brad Turpin
Product Support Engineer
National Instruments

 

0 Kudos
Message 5 of 5
(3,457 Views)