LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

curve fitting

I am trying curve fitting I have two arrys one formed by reading data from a file and other generated from a complicated equation which contains definite itegral I am doing curve fitting to to find out one para meter how this can be done

thanks in advance

augustin

 

Certified LabVIEW Developer
0 Kudos
Message 1 of 11
(3,882 Views)
Is this in any way related to your previous question?
0 Kudos
Message 2 of 11
(3,876 Views)
thank you for remembering me i have doe the same way you said inow i had two arrays one theortical and one from experiment in this i have to find best fit for beta value
Certified LabVIEW Developer
0 Kudos
Message 3 of 11
(3,872 Views)
please find the equation also
Certified LabVIEW Developer
0 Kudos
Message 4 of 11
(3,870 Views)

mjaugustin wrote:
thank you for remembering me i have doe the same way you said inow i had two arrays one theortical and one from experiment in this i have to find best fit for beta value

Well, your program is about 10x too complicated, but I cannot help much without having also the datafile.

 

  • don't use "delete from array" to get rows or colums, use "index array".
  • none of your sequence frames have any purpose, delete them.
  • Why do you convert 1D array (size, min index, etc) to 2D arrays, for the only purpose to index out the first element?
  • All your code should fit on the size of a postcard, you are doing things way too complicated

 

So please attach one of your typcal datafiles. Also include the missing subVI and I see what I can do.

0 Kudos
Message 5 of 11
(3,859 Views)
Thanks a lot for your suggestions I am attaching one of my data file in this I have to plot first and last row of data .in the function I am plotting Z value and T for various Beta value
Certified LabVIEW Developer
Download All
0 Kudos
Message 6 of 11
(3,834 Views)

The VI  i had developed  is also sending with this .I am new in this  .so please help me to do things in most easiest way

Thanking you 

Certified LabVIEW Developer
0 Kudos
Message 7 of 11
(3,824 Views)

What are the adjustable parameters and what inputs should be kept constant?

 

I see you are using LabVIEW 7.1. This will make things quite a bit more complicated, because all the fitting tools have been significantly improved in LabVIEW 8.0. Do you have access to a newer version?

 

I wrote some custom tools for earlier versions, but I no longer have access to 7.1, so I won't be easily able to make an example for you.

 

As a first step, you should calculate the theoretical curve for the exactly same x-values as your data. This means you should use a FOR loop and simply feed it the X-array as an autoindexing input. Now you have corresponding y values for each x and can easly compare y(real) vs. y(fit) in a 1-1 fashion, e.g. to calculate chisquared. There is no need generate a seperate x-range. Since the x-values are evenly spaced (I think) you don't even need an xy-graph, simply use a waveform graph and adjust x0 and dx according to the x-array.

0 Kudos
Message 8 of 11
(3,802 Views)

Thanks for your reply.In the equation  T varies with Z  .I have to find for what value of Beta the equation satisfies for experimentaly obtained data.At present I have had access to 7.1 only.Please give me some ideas to fit with equationwith available tools in it .

thanks a lot for your time and suggsstions

regards

augustin 

 

Certified LabVIEW Developer
0 Kudos
Message 9 of 11
(3,786 Views)

You need at least two parameters, it seems beta adjust the amplitude and e.g. W0 (or the wavelength, they are fully correlated here) adjusts the width.

 

Attached is a very quick rewrite, downconverted to LabVIEW 7.1. The file IO part did not downconvert correctly, so for simplicity, I added your data as a diagram constants. Also the square function was not available. As predicted, the entire code (and more) can be fit on a postcard, and you don't even need the subVI.

 

To use, just run it and manually adjust the W0 and Beta with the sliders and see how the function changes. ( I disabled the other controls, because they currently only get read at program start anyway. If course you would want to implement an event structure, so recalculations only occur if needed. Change them in edit mode if needed.

 

So far it does not do any fitting, simply because I no longer have 7.1 so I cannot do this for you, but a simple 2-paramter fit should be easy to implement. I don't recommend the LabVIEW.7.1 version of the levenberg marquardt fit, it has too many limitations. In this old post is an example that calls the model by reference using a home-made variation. It should be trivial to adapt it to your situation (which is even simpler!). All you need to do is wrap the model in a subVI as shown.

 

For comparison, I show you also an image of the FP and diagram of the simulator in LabVIEW 8.5.1. As you can see, the file IO is much more functional in newer versions.

 

Message Edited by altenbach on 09-01-2008 01:03 AM
Download All
Message 10 of 11
(3,775 Views)