photon_guy Posted July 17, 2008 Report Share Posted July 17, 2008 I am a beginner in LV and My problem is something like this. I am trying to fit the photon diffuse equation. I am testing the command before using really data. Therefore, I generate the equation waveform then use the nonlinear fitting to solve it. however, the fitting is not right. Also I am having problem in graphing the fitting curve. Thanks. Quote Link to comment
mross Posted July 17, 2008 Report Share Posted July 17, 2008 QUOTE (photon_guy @ Jul 15 2008, 08:09 PM) I am a beginner in LV and My problem is something like this. I am trying to fit the photon diffuse equation. I am testing the command before using really data. Therefore, I generate the equation waveform then use the nonlinear fitting to solve it. however, the fitting is not right. Also I am having problem in graphing the fitting curve. Thanks. I am not familiar with photons, but are not most diffusion phenomena Arrhenius functions? http://en.wikipedia.org/wiki/Arrhenius_equation Quote Link to comment
Francois Normandin Posted July 17, 2008 Report Share Posted July 17, 2008 Many reasons why it won't work. And also some interogation marks in my head too... 1- Your example won't work because your data is not linearly independant. Your matrix is singular (determinant = 0) because in your simulation, all your data are integer multiples (only loop number changes). You produce the equivalent of this: 1 2 3 | 1 2 4 6 | 2 3 6 9 | 3 which is equivalent after reduction to: 1 2 3 | 1 0 0 0 | 0 0 0 0 | 0 This system cannot be solved because the solving algorithm relies on inverting the matrix. By definition, singular matrices cannot be inverted. Try generating your simulated data with some noise, using a random number to throw it out of its perfect line... This way, you'll generate data that doesn't algebraicly cancel each other out. Also, get some code out of the big loop, as it is not necessary to calculate the same thing 1000 times when it can be replaced by a constant value. 2- However, this thread here talks of the same problem... and no answer could be found other than starting the algorithm close to the expected values of a1, a2, a3... I ran a simple fit and got good results, except that the error message didn't disappear until I started the initial parameters at different values (a1 =! a2 =! a3) ... I don't know why I had the singular matrix error message when a1 = a2 = a3. As far as I know, 1 2 3 | 0.2 1 3 4 | 0.2 2 6 7 | 0.2 is not a singular matrix... Anyway, starting with {0.19, 0.20, 0.21} got rid of the error. 3- See also this thread on ni forums. So, my simple example worked out but when I ran your code with some modifications (random data), I couldn't get it to fit your data... We'll have to find out the reason, because I'll have a hard time sleeping in the coming days. Let us know of your progress. I hope my explanation will help you out. Now is my time to go to sleep... :clock: If I dream of anything useful, I'll let you know! PS. Sorry I didn't use the express VI like in your example. I tend to avoid them as I test solutions. They're completely equivalent to the code you had... I don't mean thta as an editorial on Express VI use. Quote Link to comment
photon_guy Posted July 17, 2008 Author Report Share Posted July 17, 2008 The program is working. I used you example, just changed the formula and it worked. Thanks very much I'll explain why I want to fit the diffuse appox. equation: The program fit for the diffuse reflectance, R(r,t), for the sample. The device: We are using two fiber optics, one as emitter and the other as collector. Results: By fitting the curve, you can obtain optical properties of sample ( absorption coeff., scatter coeff prime and the distance between the fiber optics). Thank you for your help. Quote Link to comment
photon_guy Posted August 29, 2008 Author Report Share Posted August 29, 2008 Lately, I am trying to solved the data that I got from the Monte Carlo (MC) Simulation for photon propagation in turbid media using the diffuse reflectance approximation equation (used in the program). However, when I used, An error occur : new int. coeff. is needed. Am I doing something ?? The optical properties used in the MC program is mu_s prime = 10 , mu_a = 0.1 , and r = 1 In the program -> (a) (b) © Thanks Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.