LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Nonlinear curve fit function

Solved!
Go to solution

Do you have a link to a website that describes the model you are trying to fit? What kind of data is this?

 

Here's a quick testbench where you can look at the function calculated by the guess input (and optionally fit later). I have left out the redundant parts, so most likely you need to adjust the formula and list of parameters. personally, I think you should switch to a VI model.

 

Here's an attempt at guessing the paramteres and as you can see the curve cannot be made to look similar to the data.

 

 

Download All
Message 11 of 29
(1,740 Views)

hello altenbach

when i saw your answers, i was extremely happy.because the problem keeping annoying me for a couple of days and nights, at last, is solved. thank you very much.

the data about the fitting model is about sfg(sum frequency vibrational generation spectroscopy),which is a kind of effective process for the study of the interface of the bio-polymers.actually, we generally use ORIGIN(a software) fit the data from the sfg, but recently i am self-learning the labVIEW, so i want to have a try with labVIEW. this software is really uneasy for me. let me tell you more about the sfg. 

the formular is very complex: 

y=y0+(nr*cos(alpha)+a1*(x-w1)/((x-w1)^2+l1^2)+a2*(x-w2)/((x-w2)^2+l2^2)+a3*(x-w3)/((x-w3)^2+l3^2)+a4*(x-w4)/((x-w4)^2+l4^2)+a5*(x-w5)/((x-w5)^2+l5^2)+a6*(x-w6)/((x-w6)^2+l6^2)+a7*(x-w7)/((x-w7)^2+l7^2))^2+(nr*sin(alpha)-a1*l1/((x-w1)^2+l1^2)-a2*l2/((x-w2)^2+l2^2)-a3*l3/((x-w3)^2+l3^2)-a4*l4/((x-w4)^2+l4^2)-a5*l5/((x-w5)^2+l5^2)-a6*l6/((x-w6)^2+l6^2)-a7*l7/((x-w7)^2+l7^2))^2 

w(n) represents frequency of the IR beam, the reason why you see so many parameters is that they represents seven different vibrational modes. more details can not be available.i will try to understand the structure you offer. thanks~

best regards

0 Kudos
Message 12 of 29
(1,719 Views)

i test the VI. when i add parameters to formular, it did not work. i do not know why,.still, thank you very much. 

best regards

0 Kudos
Message 13 of 29
(1,706 Views)

Then attach your new VI....

0 Kudos
Message 14 of 29
(1,696 Views)

the vi is unchanged. just change the formular becoming more complex, 

y=y0+(nr*cos(alpha)+a1*(x-w1)/((x-w1)^2+l1^2)+a2*(x-w2)/((x-w2)^2+l2^2)+a3*(x-w3)/((x-w3)^2+l3^2)+a4*(x-w4)/((x-w4)^2+l4^2)+a5*(x-w5)/((x-w5)^2+l5^2)+a6*(x-w6)/((x-w6)^2+l6^2)+a7*(x-w7)/((x-w7)^2+l7^2))^2+(nr*sin(alpha)-a1*l1/((x-w1)^2+l1^2)-a2*l2/((x-w2)^2+l2^2)-a3*l3/((x-w3)^2+l3^2)-a4*l4/((x-w4)^2+l4^2)-a5*l5/((x-w5)^2+l5^2)-a6*l6/((x-w6)^2+l6^2)-a7*l7/((x-w7)^2+l7^2))^2.

i test the VI using y0+(n*cos(b)+a1*(x-w1)/((x-w1)^2+l1^2)+a2*(x-w2)/((x-w2)^2+l2^2)+a3*(x-w3)/((x-w3)^2+l3^2))^2+(n*sin(b)-a1*l1/((x-w1)^2+l1^2)-a2*l2/((x-w2)^2-l2^2)-a3*l3/((x-w3)^2+l3^2))^2,without nr*cosine and nr*sine and other parameters, then the VI works well, achieving my ideal fitting graph and data.but when trying to add parameters,problems occur.

thank you for your enthusiasm.

best regard

0 Kudos
Message 15 of 29
(1,685 Views)

Also the list of parameters needs to change. What are the parameters and starting value?

 

Why can't you simply attach the VI?

0 Kudos
Message 16 of 29
(1,679 Views)

parameters yo should be 0,and parameters a(n) should be decimals. others are unknown. i just do not know why it did not work, when i put all the parameters into the formular rather than a few ones........

Download All
0 Kudos
Message 17 of 29
(1,672 Views)

If you modify my VI, please give it a new name. It is confusing to have different Vis with the same name.

Are the data files the same as before?

 


@caplee wrote:

parameters yo should be 0,and parameters a(n) should be decimals. others are unknown.


What are "decimals"?

"Unknown" is not good enough. Do you at least have an order of magnitude guess?

0 Kudos
Message 18 of 29
(1,657 Views)

i am sorry.

the data file is unchanged. i think the initial parameter is not important for me now, because i just want this VI to work. as for the guessing task, my teacher will help.but now he is out . 

y0=0, a(n)=1e-1~1e-5or so, w(n) represents the frequency of the peak of wave,and the data x file represents frequency. as for "nr","ahpha", i really do not know.

thank you for your help 

0 Kudos
Message 19 of 29
(1,649 Views)

The VI you have attached does not include nr and alpha. You should attach the VI that does not work, not the one that works. 😉

0 Kudos
Message 20 of 29
(1,646 Views)