Multi variate damping least square solver
Hello all,
I am hoping to get some advice and a starting point for a challenging problem I am working on.
I have a 33x37 matrix that i need to minimize using a damping least square approach. in order to achieve the minimization I need to use a set of 50 Matrices (33x37, representing adjustment impacts) that are grouped in 12 separate catagories with different starting points and degrees of freedom, and none of the adjustment matrices are truly independent of each other (they all interact with each other to some extent.)
For the output I need the minimized matrix and the amount of each vector applied to achieve the minimized solution.
To hopefully clarify the inputs and outputs I have included an example vi with a dummy set of data.
I am hoping that someone can give me an idea of where to start, can this be accomplished using the labview libraries or will this have to use scripting via a mathscript node, or matlab? If it can be done in different ways which method is the most efficient?
I hope this is enough information, but if you need more details please let me know, although giving exact details can be difficult in this case due to IP considerations.
As always thank you in advance for any help/suggestions you may be able to offer.
Chris
Attachments:
example2.vi 25 KB
Other then using a least square method I dont have a function defined yet (trying to figure out what function to use), but essentially I am trying to find out how much of each of the adjustment matrices need to be applied to minimize the original matrices..
I hope that explains what i am trying to do a little better
Similar Messages
-
Least square circle calculation on a series of data points
I am taking a series of (x,y) part measurements that describe a circle (radius & rotation angle). The center of the part and center of rotation are offset. Looking for code to do a least square circle calculation on this data set so diameter and out-of-roundness can be estimated. Platform LabView 8.2.
Here is my simple solution from the above mentione thread:
(Is it not exaclty "least squares" in the classical sense but the sphere fit works typically very well..)
LabVIEW Champion . Do more with less code and in less time . -
I need to plot the Least Squares Regression Line (not just calculate its values with the LINEST function). Can anyone advise me on how to graph this line?
Grapher.app in OS X Utilities is excellent for that : entering data from Numbers Excel etc. into a Grapher "Point Set", plotting all your data, computing and plotting a regression curve linear or exponential or polynomial.
Unfortunately there is not a single word about point sets and regression in the Grapher Help.
So, suggest you download (free) "Instruction for Use - Grapher on web site
http://y.barois.free.fr/grapher/Documentation.html
and go to page 31 to 37, "Initiation > Lesson 6 : Treating a point set (Regression curve), and also page 68, "Appendix 1. Points sets : from speadsheets to Grapher".
If you try Grapher's regression curves, please tell us about the manual above : useful or not, too easy or difficult, readable or not etc.
Thank you.
YB24
PS. Documentation about Grapher is also here : Google "Apple Grapher" > http://en.wikipedia.org/wiki/Grapher > Article > Talk > Grapher 1.1 to 2.3 (French and English) (11th september 2012) -
hi i have a final project i have to write least squares best fit vi,vi should read the datas from a txt file and draw best fit line according to least squares method calculations and also it should show the datas in point form pls help to me i tried a lot but i got nothing...thx
Hey siktigit ys,
There are built in Least Square Fit functions in LabVIEW. Here is some information about them. If you are having trouble reading the data from the file, here is an example showing how to use the read and write VIs. In order to show your data in a graph, I'd just read the data from the text files into an array and display that array on an XY graph. That should be enough to get you started. If you need more help, just let me know and have a great weekend!
John B.
Embedded Networks R&D
National Instruments
Certified LabVIEW Developer -
Least squares method from file
hi i have a final project i have to write least squares best fit vi,vi should read the datas from a txt file and draw best fit line according to least squares method calculations and also it should show the datas in point form pls help to me i tried a lot but i got nothing...thx
Hi,
I recommend that you search the following websites for assistance:
www.ni.com
www.ni.com/community
Kareem W.
National Instruments
Web Product Manager -
Im farely new to programming and I got stuck with a linear least-squares fit problem. I am supposed to develop a method that will calculate slope and intercept of the least-squares line that best fits an input data set.
Ive been trying to figure out just how to write this program for a couple of days, but with no luck.
Can anyone give me some tips on how to write this program and what the finished program should look like?
Any help would be greatly appreciatedAtleast I believe that I am needed to return a graph. The assignment says
"Test your method usin a test driver program that calculates the least-squares fit to the following 20-point input data set, and plots both the original input data and the resulting least-squares fit line"
And then itgives me a chart of the x and y values -
Least square linear-phase FIR filter
I need to geta second order derivative of an array based on 2 stage filtering with a least square linear phase FIR "differentiator " filter. Previously this was done using the matlab routine firls using the "differentiator" tag. Any ideas how this can be done in LabView?
Thanks in advance.I don't believe that LabVIEW has any differentiation functions that use this algorithm. The only derivative function is located in the analyze, signal processing, time domain. You would probably have to build your own.
-
The covariance of the least square methods
what is the meaning of the covariance? In the least square method fitting problems ,if I should make it equal to zero??
If it isnt equal to zero ? what is the matter?
thanks for any one can explain it to me !
As a man you should be ....Hi Sharad,
Try to rename the component name and reload+rebulid the project.
If there is any build errors try to repair the DC with classpath structure and deploy the DC in server.
Hope this helps you...
Regards,
Saleem Mohammad -
Now have strange multi color lines on a 2 inch square on desk top. Also above some of Doc apps. Why?
and how to get rid of them?A Safe Mode boot help ...
Startup your Mac in Safe Mode
A Safe Mode boot takes much longer than a normal boot so be patient.
Once you are in Safe Mode, click Restart from the Apple () menu.
Then see if the lines / square is gone. -
Nonlinear least square fit problem
Hello,
I have been trying to fit the data given in the attached file. When you click command button1, the routine goes thru the NonLinearFitModelProcedure, calculates some points and gives an error message like "The return parameter in NonLinearFitCallback must be assigned a scalr value". I do not understand this error message. Any ideas? Thank you.
Cem
Option Explicit
Const numpoints = 49
Private Sub CWStat1_NonLinearFitModelProcedure(x As Variant, c As Variant, f As Variant)
' Enter the equation to fit in this callback.
' The fitter will attempt to find the best set of Coefficients that will fit the model result (f)
' to the expected result (y) generated by the GenerateData subroutine below.
' In this example, we fit the data to an exponential (f = a * exp(b*x) + c).
'f = Coefficients(0) * Exp(Coefficients(1) * x) + Coefficients(2)
If x <= c(1) Then
f = 0
ElseIf x >= c(1) And x <= (c(1) + c(2)) Then
f = 2 * (1# - Exp(-c(0) * (x - c(1))))
ElseIf x >= (c(1) + c(2)) And x <= (2# + c(2)) Then
f = 2 * Exp(-c(0) * x) * Exp(c(0) * c(1)) * (Exp(c(0) * c(2)) - 1#)
End If
Debug.Print x, f
End Sub
Private Sub Form_Load()
Open "fldwhite.txt" For Input As #1
End Sub
Private Sub Command1_Click()
'Compute the fit now.
ComputeFit
End Sub
Private Sub GenerateData(x As Variant, Y As Variant)
Dim i
Dim dum
Input #1, dum, dum
ReDim x(numpoints)
ReDim Y(numpoints)
i = 0
Do While Not EOF(1)
i = i + 1
Input #1, x(i), Y(i)
Loop
End Sub
Private Sub ComputeFit()
Dim x, Y, z, ynoisy, MSError, coef
' generate sample data
GenerateData x, Y
a0 = 0.02
b0 = 2
c0 = 2
' initial guess coefficients
coef = Array(a0, b0, c0)
' perform the fit
' The function returns the results within coef.
' The function also returns a gauge of the results as MSError.
' A higher value for this number implies a "worse" fit.
z = CWStat1.NonLinearFit(x, Y, coef, MSError)
' plot the results:
' Plot1 = Original data
' Plot2 = Original data plus noise
' Plot3 = Fitted curve
CWGraph1.PlotXvsY x, CWArray1.BuildArray(Array(Y, z))
' Display computed coefficints and Mean Squared Error
a1.Caption = Format(coef(0), "0.0##")
b1.Caption = Format(coef(1), "0.0##")
c1.Caption = Format(coef(2), "0.0##")
mse.Caption = Format(MSError, "0.00E+00")
End Sub
Attachments:
fldwhite.txt 1 KBHello Sam,
Thank you for the reply. The error number was something like 10024(?) I found out that my problem was to do with the function definition. The function limits were not set right. When I corrected it worked. But you are right that somehow I do not define the type correctly. See the routine below:
The xData and yData are defined as variant, likewise the yFit variable. The first two are populated in a for loop, therefore they are redimensioned prior to this. On the other hand the yFit variable is filled as an array by the NonLinearFit routine. This typing works for the fit routine, but it doesn't work for the plot routine where two differently typed variables, yData and yFit are used as arguments of the Array function. In order to make this to work I used CWDSP function for the XData, yData arrays which is an overkill. What is the reasonable solution for type casting these variables? Thank you.
Cem
Private Sub cmdFit_Click()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim NCoeff As Integer
Dim Coefficients
Dim mse
Dim yFit
Dim xData
Dim yData
Dim tArray() As Double
With sprResults
For j = 0 To 4
' xData = CWDSP1.Ramp(nPts(j), 0, 1)
' yData = CWDSP1.Ramp(nPts(j), 0, 1)
ReDim xData(0 To nPts(j) - 1)
ReDim yData(0 To nPts(j) - 1)
For i = 0 To nPts(j) - 1
xData(i) = CDbl(sTime(i))
yData(i) = CDbl(sData(i, j))
Next
fitType = j
NCoeff = 2
Coefficients = Array(CoefValues(0), CoefValues(1))
yFit = CWStat.NonLinearFit(xData, yData, Coefficients, mse, 25)
cwgPlot(j).PlotXvsY xData, CWArray.BuildArray(Array(yData, yFit))
Next
End With
End Sub -
Partial Least Square software in Mac OS X!
Hi! Is there anyone can help me out with any other Partial Least Regression software name that will run in mac os x, apart from smartPLS 3.0 (this is just too expensive)? Thanks
There's R: http://www.r-project.org
Not sure if the package is built in, but there is a package you can install: http://cran.r-project.org/web/packages/pls/index.html -
Multivariable least square fitting
Can Labview, specifically General LS linear Fit VI do the following fitting?
I have x, y, P as independent variables, and fit a curve B to a function of :
B = b0 +b1*x +b2* y +b3 *P + b4 *x^2 + b5*y^2 + b6 * P^2 + b7* x*y + b8*x*P + b9 * y*P;
There are 12 data points to get 10 coefficients, b0-b9.
I'd appreciate any comments. Thanks,You have three independent variables (x,y,P), one dependent variable (B), 10 linear coefficients, and 12 datapoints B(x,y,P) in 3D.
All coeefficinets are linear, so all you need to do is setup the H matrix and B vector according to your data, then use general linear fit.
How does the data look like? What does it represent? Can you attach a typical dataset?
Note: Since you call it "general LS linear fit", you must have an older LabVIEW version, but it is the same as "general linear fit" I mentioned above. It should be able to handle this problem easily. Have you tried?
LabVIEW Champion . Do more with less code and in less time . -
Problems about nonlinear least square( waiting online)
This time I met a problem again,as you see when I set the parameters Amplitude=10000 or greater ,then the output will not turn out .
Another problem is the derivative of the output on the waveform wobble after I click run for a while
As a man you should be ....
Attachments:
ZQH_BYSJ.llb 330 KBCan you explain what you mean by wobble? (e.g. attach a picture)
Your toplevel VI only runs once because there is no while loop. How do you run it "for a while" then? I pressed the run button 50 times, but nothing changed....
If your amplitude is set to 10000, the function has a range of over 10^17, mostly because you take the fourth power. On that same scale, the influence of the lower order terms(a , b) now only contribute an infinitesimal small fraction to the signal (way beyond the scope of DBL or EXT) and thus can no longer be determined. Your problme is out of balance because the C and D completely dominate the result. As explained elsewhere, you need to keep your amplitude in a reasonable range and instead scale the fitting parameters.
LabVIEW Champion . Do more with less code and in less time . -
Hi,
I would like to fit my data (about 200 kpoints) with a sine-wave (with 4 parameters : A.sin(2pi.B.t + C) + D) in LabVIEW. I'm looking for a VI with a convergent algorithm (such as least-square solver) which return me the 4 parameters + the RMS error betwen measurement data and model data. Or why not a more efficient algorithm...
I have a look in "Optimisation function set" and also in "Ajustement function set" but I didn't find the good VI, Someone can advice me ?
Regards,
BenjaminYou can use the levenberg-marquard fit , but usually the extract single tone information work good enough
There is a paper from 99 ni'week about the performance of this vi, I added it, because I missed the link
Depending on your signal, it might be wise to try blocks of complete periods and mean the results....
I attached a vi that uses this single tone vi to monitor the line frequency , just abuse a headphone as a coil receiver and plug it into the mic input of your soundcard and place the headphone near a transformer...
Greetings from Germany
Henrik
LV since v3.1
“ground” is a convenient fantasy
'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
Attachments:
line freq with soundcard v2.vi 35 KB
FFT tone detection Moriat NIWeek99.ppt 1159 KB -
[Solved] FN key locked in on position after update S431
Hello,My computer did updates and I restarted. Upon restart, the green light on the fn key is permanently on and it won't turn off. How do I fix this problem? I went into bios, but the only option available is fn/crtl key switch. I have a brand new Lenovo Thinkpad S431 running Windows 8 FIXED: APPARENTLY PRESSING FN + ESC ENABLES FUNCTION LOCK. I FEEL SILLY, BUT AT LEAST I SOLVED THE PROBLEM. HOPEFULLY THIS IS HELPFUL TO SOMEONE ELSE IN THE FUTURE.
Took the effort to register just to say thanks. People who are Googeling come here so... Thanks. Saves me an annoying light on my work laptop.
Maybe you are looking for
-
I recently got a macbook air and want to transfer some books from my Adobe Digital Edition Library that is on my Apple iMac onto my new Macbook Air. Anyone know how to do this?
-
Transfer apps from iphone 3GS to iphone 4
I am upgrading from iphone 3GS to iphone 4. I have several applications and music which I have bought from apple store with my appleID. Can these apps be moved to iphone 4 if I use the same appleID... or do I need to repeat these purchases again?
-
Journal Entry for Service Tax Non-Deductible.
Dear Experts, I have created an A/P Invoice for a Service item with Service Tax Non-Deductible(100%). For that we got the journal entry as below. Journal Entry Edu. Cess on Service Tax Payable Dr. 00 HCess on ST Payable Dr.
-
How to get the range of a textbox in the footer of the 1st page ?
Just like the problem says, how do I use VBA to get the range of the textbox in the footer of the 1st page?
-
Hi, I am having issues with ine if my background jobs in RA 5.3, I know this sounds stupid but I can not remember where to find the error log, please help