10-05-2009 09:21 AM
I am back from one trip, and have a couple of days before the next, so time for a few more installments. I am in a curve fitting mood, so a trifecta of fitting this week. To get warmed up, today it is "General Polynomial Fit.vi". This VI uses the linear least squares method to fit a polynomial to a set of data points. It is a special case of the general least squares VI (tomorrow's VIOTD) in that it calculates the design matrix for you.
A few notes about the choices you face using this VI. The first is the weight, unless I have outliers or specifically know the uncertainties in the y values I usually leave this one empty to weight all points equally. The second choice is the algorithm. Singular Value Decomposition is the method of choice for least squares problems. It may not be the fastest, but it is very robust. The two Givens methods are prone to roundoff and overflow and therefore I believe that Householder is a better choice than either of those. Cholesky is a reasonable choice and I have never had a chance to try LU decomposition. Overall, I would suggest that SVD be used essentially all the time.
Now to fit something. I am bored with the usual methods of generating fake data so in this example you can click on the graph to place data points along the cable of a suspension bridge. When you have chosen at least three points click fit and you will see the parabolic shape of the cable.
10-05-2009 09:47 AM
A cable which suspends only its own weight follows a catenary curve not a parabola, although they look similar. I am not sure how much the loading of a suspension bridge changes the shape of the curve. The catenary cure is a hyperbolic cosine. Search Wikipedia for "catenary."
Lynn
10-05-2009 09:54 AM - edited 10-05-2009 09:56 AM
A suspension bridge cable is loaded primarily by the bridge deck via the vertical cables (visible in the picture) which are evenly spaced horizontally. With even loading per horizontal distance, the solution is a parabola. Under its own weight, the loading is even per unit length of the cable (ds instead of dx). In this case you are solving a version of the brachistochrone problem and get the catenary solution.
I haven't tried, but if you try fitting the cable shape to a catenary I imagine you'll see some differences at the edges since the catenary has more curvature than the parabola.
Thanks for jogging the old memory. When I see a suspension bridge I just think parabola, I hadn't thought about why that is for a while.
10-06-2009 09:46 AM