02-20-2017 04:16 AM
Hi
Can any one help me how slope of a linear curve is calculated in linear fit vi.
i calculated based on simple math formula but im not getting how linear fit vi is calculated.
i attached a vi, Please help in solving this problem.
Thanks and Regards
Ramesh
02-20-2017 05:45 AM - edited 02-20-2017 05:46 AM
Hi Ramesh,
when you think the linear interpolation is bad you should plot your data and the curve:
(black: your data, red: linear interpolation)
Why do you think a linear interpolation would give "good" results with your data?
See my attachment…
02-20-2017 07:05 AM
Fitting a function (like a straight line, a "linear fit") to a set of data involves creating a model that describes a relationship describing the data, some (statistical) assumptions about the distribution of errors in the measurements, and a fitting criterion for "what is the best fit?".
A common model, set of assumptions, and criterion is (model) there is a linear relationship between X and Y, (assumptions) X is "known" and Y is "measured", with some (often normally-distributed) variation about the "true" value, and (criterion) you want to find the value of Y (as a linear function of X) that minimizes the squared deviations between the measured Y values and the Y value predicted for that value of X. This is usually called the "Method of Least Squares".
Given a set of (assumed precisely measured) X and (assumed measured with error) Y values, it is an easy calculus exercise to derive a formula to calculate the Y intercept and slope of the line that fits the data in the "Least-squares" sense. This (should be) what the Linear Fit routine returns to you, particularly if you use the default "Least Squares" fitting method.
Bob Schor
02-22-2017 05:37 AM
Hi GerdW,
Thanks for your reply.
Why do you think a linear interpolation would give "good" results with your data?
The data which i linearly interpolated is not the best for my application. My intrest is to find the slope of the curve. the way i found slope in that vi is simple but its is not good for my application.
So im using linear fit vi, but i dint get how they calculated slope.
The modified vi you shared here is helpful.
Thanks & Regards
Ramesh
02-22-2017 05:45 AM
Hi Bos_Schor,
Thanks for your information that helps me in finding a solution.
I find slope based on some mathematical assumptions and formulae in math's , concepts under least square method. I got the exact results as same as linear fit vi values. find the attached vi for more details.
Thanks & Regards
Ramesh
02-22-2017 11:56 AM - edited 02-22-2017 11:59 AM
@Rameshgowda wrote:
find the attached vi for more details.