LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Lev-Mar-algorithm

Hey there

 

I've got a problem with a Lev-Mar-Fit. But I'm neither a very experienced LabVIEW-user nor a good mathematician, so please don't tear me appart, if the solution should be obvious Smiley Happy

 

What my programm should do:

I'm using [ function generator => LED => Fluorophor => photodiode => oscilloscope ] to identify the lifetime of the fluorophor. The programm scans with a sinus-function through a variety of frequencies (log scale) and calculates the phase-shift form the led-source to the photodiode-input. This value is than substracted from a referencefile (which includes the complete setup, but without the fluorophor).

The result is the pure shift within the phase angle, which is connected to the lifetime by the following equation:

formula.JPG

 

 

What my program does at the moment and what my problem is:

Well, actually almost everything works fine (as you can see on the image below). But right now, I can only calculate the lifetime for each frequency independently, using the phase shift and the corresponding frequency. In order to receive a better result, I would like to make a Lev-Mar fit on this curve, and then calculate one precise life-time from the fit-result...

 

Phase Angle.jpg

 

Could you please tell me, how to implement my formula, as the Lev-Mar-VI seems quite tricky to me...

 

Thanks in adavance for any helpful input...

cheers, Reepicheep

 

 

my current LabVIEW-Version: 2010

 

0 Kudos
Message 1 of 10
(2,899 Views)

Hi,

 

thanks for your question! As I understood you correctly you want to use the Lev-Mar fit?

As you can see in the example from the LabView examples (see below) you need a function to estimate your curve. Is there any chance you can make this estimation?

 

Feel free to ask again if there is something unclear.

 

Cheers

 

 

0 Kudos
Message 2 of 10
(2,854 Views)

Could you simplify and isolate the relevant code as follows:

 

 

  1. place indicators on the wires going to the x and y inputs of the nonlinear fit.
  2. run your VI so these indicators contain data.
  3. Disconnect these indicator terminals and right-click "change to constants". Label them as x and y.
  4. Now we have typical data available for testing without the need for all that acquisition code!
  5. delete everything except that case structure near the bottom right
  6. Save under a new name and attach it here again.
I've fit curves in the past that look very similar and it should be trivial to create a model VI. I guess the frequency is x and the phase shift is y, and there is only one parameter tau. You need an initial estimate for it.
What are your frequency units, they are not labeled? Hz?

 

0 Kudos
Message 3 of 10
(2,847 Views)

Here's a quick draft that simulate the curve with noise and tries to fit it. Works fine....

 

Unzip them main code and the model into the same folder, run the main program. Let me know if you have questions.

0 Kudos
Message 4 of 10
(2,824 Views)

Can anyone do me the favour and convert my original file to one, that will work on LabVIEW 9.0?!?

 

I didn't have access to the necessary equipment during the last weeks. And althoug I do now, I can't start the programm cause I wrote it on my Version 10 Trial, which expired last week Smiley Surprised And my company only has the full licence for labVIEW 9.0 (of course, I also forgot the save it somewhere in a compatible file)...

 

Would be great Smiley Wink

0 Kudos
Message 5 of 10
(2,774 Views)

Hi, I hope that is what you want?

0 Kudos
Message 6 of 10
(2,764 Views)

@niceday: thanks for the converting!

 

@altenbach

 

I attached the file with the saved constants.

 

My initial estimate for tau would be 3 microseconds, i.e. 0.003ms (as the programm works with milliseconds). And sorry, the frequency-unit is kHz.

 

greetings,  reepicheep

 

 

P.S: thanks also for you simulation. I played around with it a bit, but as I had no access to my instruments at that time, I couldn't really test it... And now that I do have access, I can't open them because they are from LabVIEW 2010 as well...

0 Kudos
Message 7 of 10
(2,755 Views)

Nothing?!? Nobody?!? Smiley Sad

0 Kudos
Message 8 of 10
(2,705 Views)

Attached is the Liftime with constants.vi which I have converted to LabVIEW 2009. Is that what you need?

0 Kudos
Message 9 of 10
(2,689 Views)

Here is my version in LabVIEW 2009, but now with your real data plugged in. See if it helps.

 

(Of course the loop only needs to spin when the guess changes, so modify as needed).

 

Download All
0 Kudos
Message 10 of 10
(2,675 Views)