06-25-2009 11:55 AM
Extremely new to Labview. I'm actually a co-op at my company. I have been able to work my way through things up to this point, but do to lack of training(which will never be provided) I have encountered a problem. I'm trying to use the curve fitting function to curve fit a signal from a DAQ Assistant. First off we have Labview 7.0 and the hardware is a SCXI-1000 chasis with a SCXI-1520 module. I have the DAQ Assistant set up for the load cell and my goal is to curve fit the voltage signal from the load cell and then write a .lvm file with the fitted data. I've looked through the help for the curve fit function, but still can't seem to get it to work. The best I got was my vi would start and then stop automatically in about 1 second or so. I can do everything other than the curve fitting.
Thanks in advace for the help.
06-25-2009 12:45 PM
06-25-2009 12:47 PM
Let's try to separate the problems.
1. It sounds as though you can acquire a signal, but only one time before the program stops. Is this correct? This may not have anything to do with the curve fitting.
2. Do you have a good mathematical model for how the signal should behave? This is what you will be fitting the data to.
3. What happens when you try to curve fit? Do you get an error message? If so, what is the error code? Does the fitted curve not look like the data? In what ways? Please show some actual data along with an image of what the fit should look like.
4. Does the file write part work?
Please post your VI as you have it so far. It is much easier to troubleshoot a VI than a paragraph. Take some typical data. Then go to Edit >> Make Current Values Default. Save the VI. Then post the VI you just saved.
Lynn
06-25-2009 12:56 PM
What kind of fit do you try to perform?
Please post code/screenshot of the piece where you're stuck.
Felix
06-25-2009 01:16 PM
Everything works until I add the curve fit part. I am attempting to perform a 6th order polynomial fit. I have attached screen shots of the working vi, the not working vi, and an excel plot of the data.
06-25-2009 01:22 PM
Ok, we need some more info. Can you post you Express Vi configuration. Or even better, get rid of all that Express-things and use the 'General Polynomial Fit.vi'. (Located under Analyze -> Mathematics -> Curve Fitting in 7.1). Do you get any error codes?
BTW: Looks like it is a gaussian profile, so why not use that function to fit is?
Felix
06-25-2009 01:33 PM
06-25-2009 01:40 PM
For the math VIs you only have an I32 error code. In the Time & Dialog Function palette you find a vi to convert that to a LV error cluster. To the right of your loop, place a general error handler.
To help us solving your problem, you could do the following: Create a subVi from your Fit Vi (Select VI, Menu: Edit -> Create SubVI). Run your program. Go to the SubVi and select Edit -> Make Current Values Default. Post that SubVI to this thread, then we can run it with the data on our own PC's.
Felix
06-25-2009 01:42 PM
06-25-2009 01:53 PM
On your screenshot, I clearly see that you have not defined the polynomial order (which should be 6 as you say). Also, you only gave Y-values, no corresponding X values (guess that is the issue for everything). There is an example shipping with that Vi to get you more help. Go to the Help Window (Ctrl+H) and Click 'Click here for more help'. On the bottom of that page you will find an option to find/browse the examples.
To the general question of peak detection. You could go as simple as just to look for the maximum in your data array. If you have no noise, that is ok. But as the signal contains some noise, you're better of using a fit (but you must have some physical model of the process to know which fit to use!). The fit coefficient you will wire into an find maxima vi (I don't have the name in my mind), which mathematically will give you the correct location of the 'peak'.
It really depends on the physics and less on LV, but the people on this forum are experts on these domains as well.
Felix