LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What LabVIEW examples can we use to get a Linear Graph between experimental points, which contains the AXSI ORIGIN?

To discover the Ohm's Law, I = V / R, by the analysis

of a set of data(I,V) we need a Linear Feet

in order to get a graph between experimental points,

graph which contains the origin of the axis.

We created a program, which uses Regression Solver,

but
the graph we get, does NOT contain the AXIS ORIGIN.

You can download our program from the next location
http://www.credislabviewtoolkit.home.ro/Download/Ohm's%20Law%20-%20Data%20Analysis%20with%20Regression%20Solver.llb

Please help us to get the best Linear Feet,

to get a graph, ( between the experimental points )

which contains THE AXES ORIGIN

What LabVIEW exam
ples can we use to get a Linear Graph between experimental points, which contains the AXSI ORIGIN?

Thank you very much, Tonio and Alex
0 Kudos
Message 1 of 6
(3,043 Views)
To get to your solution, you must not use linear fit, because you do not have 2 variables (a and b if Y=a.X+b).

In your case b is nown and is 0
¨
So we only have to solve for Y=a.X, one unknown.

In this case, the solution is trivial :
a = mean(Y)/mean(X).

Doc-Doc
Doc-Doc
http://www.machinevision.ch
http://visionindustrielle.ch
Please take time to rate this answer
Message 2 of 6
(3,043 Views)
Hi

You touched our souls by answering us immediately (after) we posted our question.
Thank you very much.

We would like to get programs (on the shortest way),
by combining and merging our programs and LabVIEW customized programs.

Too bad the graphs we get do not contain the AXES ORIGIN.

We wonder whether we can find in LabVIEW an example like "Regression Solver" is,
but for the particular case Y = a.X, not for the GENERAL CASE Y = a.X + b.

We do not work only with two data, potential difference, V, and the current, I.
We work with a set of 9 pairs of data, V and I, one of them being (0 V,0 mA)

By using our program we got the next set of pairs of data,
(which contains little errors, like the data given by the real instr
uments).


V [V] = { 0.00 1.50 3.03 4.48 6.01 7.44 9.03 10.47 12.03 }
I [mA] = { 0.00 2.30 4.61 6.90 9.09 11.43 13.78 16.04 18.32 }


To understand better what we want to do, please work a little with our program
"Ohm's Law Data Analysis with Regression Solver.llb".

We hope that you will not regret
We put that program on Internet, with its diagram, at the address
http://www.credislabviewtoolkit.home.ro/Download/Ohm's%20Law%20-%20Data%20Analysis%20with%20Regression%20Solver.llb

We used the subVI "Alex and Tonio's Customized Regression Solver"
in order to get the graph of a set of 9 pairs of data,
between 8 experimental points and through the AXES ORIGIN.

We got the program "Alex and Tonio's Customized Regression Solver"
by modifying the LabVIEW program "Regression Solver"

You can find the original "Regression Solver", by following the next way
Help -> Find Examples -> Browse Palette -> Analyzing and Processing Signals -> Curve Fitt
ing and Interpolation -> Regression Solver

Thank you very much again for your words,
which helped us to find a better way to explain what you want.

We are looking forward to hearing from you,
Sincerely Tonio and Alex
0 Kudos
Message 3 of 6
(3,043 Views)
Hi Alex, Tonio:

the problem is that even the simplest of your regressions, the Linear regression, is too complicated. It assumes a relation of the form Yi=a*Xi+b. In order to calculate a regression one tries to find values a and b such that the sum of the squares of the errors becomes a minimum:
error=Sum[(Yi-a*Xi-b)^2]-->minimum
(That's why the method is called 'least squares fitting). a and b are determined by setting the partial derivatives of 'error' with respect to a and b equal to zero and solve the linear equation system of the two unknowns.

In your case you have the model function Yi=a*Xi, the b is known to be zero. The error function is:
error=Sum[(Yi-a*Xi)^2]
and
d(error)/da = 2*Sum[(Yi-a*Xi)*(-Xi)]==0
from which foll
ows
a=Sum[Xi*Yi]/Sum[Xi^2]

This is different from what Doc-Doc answered, but you will hardly see this difference in your numeric data which are very close to a straight line.

The assumption about the statistical errors in your data is that the error of the values Xi is zero (or at least much smaller than the error of the Yi data).

In your case there might be similar errors in Xi as in Yi and therfore a might as well be estimated as
a=Sum[Yi]/Sum[Xi]
or as
a=Sum[Yi/Xi]

I provide a small VI that demonstrates the calculation..


Have fun

Franz
0 Kudos
Message 4 of 6
(3,043 Views)
Hi

The first part of this letter is an acknowledgement. The middle part is about one of our programs, �Methods of Data Analyses by Linear Regression.llb.� and the final part shows where we need help.

We thank very much to �Franz�, for the HELP he gave us to improve our program, called now, Methods of Data Analyses by Linear Regression.llb.

Franz explained and offered us two methods/formulas of calculating the value noted �a�. The quantity �a� appears in the relation Yi = a.Xi.

To make every visitor of our site to know that Franz helped us, we copied his topic, which refers to Regression Solver, from NI.com to our page.

See www.CREDISLabVIEWToolKit.home.ro/LinearRegression.htm ,

We also mentioned his contribution o
n the page
www.CREDISLabVIEWToolKit.home.ro/DataAnalyzingTools.html

The program �Methods of Data Analyses by Linear Regression.llb.�, in which we included those formulas can be downloaded from: http://www.credislabviewtoolkit.home.ro/Download/Methods%20of%20Data%20Analyses%20by%20Linear%20Regression.llb

We hope that you will have some time to download our program and work a little with it.

You should increase the �Error Factor� from 0 to 1 step 0.1 and compare the results given by different methods to calculate the electrical resistance.

Because the object LabVIEW 6.1 �Linear Fit� does not show the formulas used to analyze data, we are looking for help to discover two formulas, one for �a� and the other one for �b�.

Y = a.X +b

I got two formulas, by following the way Franz sowed us, but the results I got by using those formulas and the results obtained with Linear Fit are different

I need your help to compare my formulas with the formulas obtained by you.


Franz, I hope that you will have a little time to help us again
Thank you very much again, NI.com and Franz.

Have fun. (We really had a lot of fun, after we received your help).

Tonio and Alex
0 Kudos
Message 5 of 6
(3,043 Views)
Labview's 'Linear Fit' calculates the a and b as:
a=(N*[xy]-[x]*[y])/(N*[x^2]-[x]^2) and
b=([x^2]*[y]-[x]*[xy])/((N*[x^2]-[x]^2))
where Nis the number of data anmd the notation [x] stands for Sum(Xi], [xy] for Sum[Xi*Yi] and so on.

The above is (after some math) equal to
a=[(x-)*(y-)]/[(x-)^2] and
b=-a*
with the same abbreviated [] notation for a sum over i and with =[x]/N, =[y]/N being the average values of the Xi and Yi.

This is also explained on
http://www.itl.nist.gov/div898/handbook/pmd/section4/pmd431.htm


and similar pages.


You should try to work ouit these formulas for yourself as an exercise.

Grüsse nach Rumänien (is that correct?)


-Franz
0 Kudos
Message 6 of 6
(3,043 Views)