LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

levenberg marquardt sub VI - LM abx vi

If you calculate the model using your X values and your initial parameter guesses, the last eight values are NaN.
0 Kudos
Message 11 of 20
(1,719 Views)
Your model is not correctly parameterized, because a1 and a2 are 100% correlated. In the formula, they only show up as (a1/a2), meaning any change in a1 can be fully compensated by a change in a2.
0 Kudos
Message 12 of 20
(1,711 Views)

right... okay, so this is because using those guesses would be an exponential plot shifted slightly to the left, and so it reaches y (or Rp) = 1 at a smaller angle, and above that it is infinity... so it would get NaN / inf answers if the guess is low... if you guess high, you still run into problems but not on every iteration. 

 

i really appreciate your help, i have decided to pursue a different path (my orig code, calculating chi squared from some plots around the signal)... discontinuous functions are a pain. thanks again!

0 Kudos
Message 13 of 20
(1,711 Views)

sorry, i didnt see your 121PM post when i put up my 125PM post.  what you said makes perfect sense and i see that.  however, what do you suggest i do in such a case?

0 Kudos
Message 14 of 20
(1,700 Views)

Yes, the function is quite hairtrigger and a slight cahge in parameter can give NaNs. Maybe you want to skip the few highest points?

 

How accurate are the x-values? The Y-values.

 

Could there be systematic errors? For example if I allow slight shifts and offset, the fit can be quite good.

 

 

Message Edited by altenbach on 06-08-2010 12:03 PM
Download All
Message 15 of 20
(1,690 Views)

first of all, thanks again.  that plot looks great and i see how you "re-parameterized" the equation.

 

the problem i have with doing it that way is because the way i had it the values of the function correspond to the prism index and the material index, so i am able to get those actual values from the L-M. 

 

i'm thinking that i can do something that sort of matches the fit you put up to the original equation, sort of using your equation as a conduit to take me to the right values. the x values correspond to 0.1 degrees, that will be very accurate with our ~$2k rotary stage (still waiting for it in the mail). the y values are based on a "noisy" signal which i generated with labview. i don't think the actual signal will be nearly that noisy but i am giving it a noisy signal in an effort to make it a good VI.

 

let me think about this a bit and i will get back to you with any updates.  thanks though, i can definitely make progress with your ideas. 

0 Kudos
Message 16 of 20
(1,678 Views)

Dan K wrote: 

the problem i have with doing it that way is because the way i had it the values of the function correspond to the prism index and the material index, so i am able to get those actual values from the L-M. 


 

 
 You are kidding, right?
 
If you fit for a1/a2 as two parameters, the values are 100% correlated and you don't get any meaningful result because the simulation outcome would be exactly the same if you would multiply the two parameters by a million, for example.
 
For example if the correct ratio is 0.5, the following results are equally good and levenberg marquard will randomly pick something:
 
a1=1, a2=2
a1=20000, a2=40000
a1=-0.003, a2=-0.005
etc.
 
There is no way you get actual values for both prism index and the material index! 
0 Kudos
Message 17 of 20
(1,672 Views)

i know what you're saying, and i share your disbelief.

 

but if you look at the paper attached, and my calculations, you will see what i mean. this is a problem i am trying to work around.

Download All
0 Kudos
Message 18 of 20
(1,659 Views)
i think if i just use one parameter - the ratio of the index of the material to the index of the prism, which i called gamma - then i can make it work, because i will probably know the prism index to a very high degree.  there will be some uncertainty in that measurement but i think we will know it accurately enough.
0 Kudos
Message 19 of 20
(1,639 Views)
Yes, typically you know one to determine the other. I would define the prism index as a constant, settable by the operator, then fit for the material index. 😉
0 Kudos
Message 20 of 20
(1,622 Views)