LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Curve fitting only part of a waveform

Solved!
Go to solution

I am taking some data from an Oscilloscope and I need to do a curve fit.  As you can see from the data in the attachment the data begins at 0 and ends a 10e-6.  I just want to curve fit the part from 5e-6 to 10e-6.   This is what I have tried

 

1) I take the waveform and use a "Get Waveform Components".  I then take the Y data and strip off the first half of the data from the array.  Then I  use a "Build Waveform" and put in the new Y data and the dt data to make the NEW waveform.  I then put it in to the Curve Fitting Express VI.  This works well for the slope, but of course the intercept is off because the data that was at 5e-6 is now at 0.  And the data at 10e-6 is now at 5e-6 since I stripped off the first 5e-6 of data and rebuilt the waveform.   I thought I could use the "t0" value in the "Build Waveform" to set the start of the NEW waveform to be 5e-6, but it seems that the "t0" is only for a timestamp (its a calendar data). 

 

2) I thought about converting the waveform in to X and Y data because it would be easy to shift the X data by just adding 5e-6 to each value in the X array.  But then it wouldn't input to the Curve Fitting Express VI. 

 

3) I thought about using the "Locations" input to the Curve Fitting Express VI, but I haven't really been able to get that to work. 

 

Thanks for any help. 

0 Kudos
Message 1 of 3
(3,926 Views)

Hello,

 

Check out these examples and online docs relating to curve fitting. Perhaps they will be of some use.

 

 5th-order Curve Fitting Using Curve Fitting Express VI

Linear Curve Fitting a Random Waveform Graph

Overview of Curve Fitting Models and Methods in LabVIEW

Introduction to Curve Fitting

 

Best,

National Instruments
Applications Engineer
0 Kudos
Message 2 of 3
(3,872 Views)
Solution
Accepted by topic author lme999

Get away from the express VI and use the plain tools operating on simple array data. Many of the fitting VIs (e.g. linear fit) have an input for "weight", so set the weight to zero for the data outside the desired range. You can also simply take a subset before fitting.

0 Kudos
Message 3 of 3
(3,864 Views)