09-04-2014 10:06 AM
I have data the consists of a single column of y values and multiple columns of x values. What I am trying to do is re-create an excel spreadsheet calculation in Labview. The excel sheet using the Linest function, however the intercept is calculated normally (const = true). I have read through the forum and found that I can use the General Linear Fit vi to perform my calculation, but the this vi forces the intercept to be zero. This there a way in labview to do the fitting like it is done in excel?
Solved! Go to Solution.
09-04-2014 10:15 AM - edited 09-04-2014 10:24 AM
Just use the plain linear fit!
(If you are discussing something you found in the forum, you should always include a link so we can see what you area talking about. What you probably found was a workaround that forces an intercept of zero for a special scenario. If you want to use general linear fit anyway, your matrix simply also needs a constant term)
If you still have problems, show us your code and some data.
09-04-2014 10:26 AM
Sorry here is the previous post that I found:
There-is-a-function-in-excel-called-linest-that-will-perform
What you have suggested using the linear fit does not allow me to use an array for the x values.
09-04-2014 10:29 AM
That should have said "does not allow a matrix for the x values"
09-04-2014 10:52 AM
@Terry_S wrote:
That should have said "does not allow a matrix for the x values"
I don't understand what you mean by that. The x-values are always an array. if you only had a single x value, linear fit would make no sense.
Please attach your code with some typical data.
09-04-2014 10:59 AM
In the array pallet, there are the Array to Matrix and Matrix to Array functions. Even though you may have a matrix with N rows and 1 column, it will create a 2d array. Just index the first column of the array, which will return the 1d array that you need. The snippet I have attached illustrates this.
In the Functions>>Mathematics>>Fitting>>Advanced Curve Fitting pallet, there are many more functions that might be of use to you.
09-04-2014 11:24 AM
Please don't bring matrix datatypes into the discussions.
We are talking about 2D arrays here. none of the fitting VIs deal with matrix datatypes.
09-04-2014 11:26 AM
I think I have given everyone the wrong idea with my poor wording. What I what to do in a muliple linear regression. The image below shows an example of what I have so far.
I need to have the same Coefficent values that I get when using the Linest funtion in Excel. The Linest function can be set to calculate b normally or set to zero. I my case I have is set to calculate normally. How can I do this in Labview?
09-04-2014 11:44 AM
Try appending an additional column to the data array that is all 1's.
09-04-2014 11:57 AM