11.07.2015 Views

MatlabNotes

MatlabNotes

MatlabNotes

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

It is well–known that the solution of this systemcan be overwhelmed by numerical rounding errorin practice unless great care is taken in itssolution (a large part of the di culty is inherentin the loss of information in computing thematrix–matrix product A T A). As in the solutionof square systems of linear equations, specialtechniques have been developed to addressthese issues and they have been incorporatedinto the Matlab routine library.This means that a direct solution to the problemof overdetermined equations is available inMatlab through its left division operator “\”.When the matrix A is not square, the operationForce F [N] Deformation x [cm]5 0.00150 0.011500 0.0131000 0.302000 0.75Table 1: Measured force-deformation data forspring.byr 1 = x 1 k 1 + x 2 1k 2 F 1r 2 = x 2 k 1 + x 2 2k 2 F 2x = A\bautomatically gives the least squares solutionto Ax = b. This is illustrated in the next example.Example 16.1 A spring is a mechanical elementwhich, for the simplest model, is characterizedby a linear force-deformation relationshipF = kx,F being the force loading the spring, k the springconstant or sti↵ness and x the spring deformation.In reality the linear force–deformation relationshipis only an approximation, valid forsmall forces and deformations. A more accuraterelationship, valid for larger deformations,is obtained if non–linear terms are taken intoaccount. Suppose a spring model with a quadraticrelationshipF = k 1 x + k 2 x 2is to be used and that the model parameters,k 1 and k 2 , are to be determined from experimentaldata. Five independent measurementsof the force and the corresponding spring deformationsare measured and these are presentedin Table 1.Using the quadratic force-deformation relationshiptogether with the experimental data yieldsan overdetermined system of linear equationsand the components of the residual are givenr 3 = x 3 k 1 + x 2 3k 2 F 3r 4 = x 4 k 1 + x 2 4k 2 F 4r 5 = x 5 k 1 + x 2 5k 2 F 5 .These lead to the matrix and vector definitions2 3 2 3x 1 x 2 1F 1x 2 x 2 2A =6 x 3 x 2 3 74 x 4 x 2 5 and b = F 26 F 3744F 45x 5 x 2 5F 5 .The appropriate Matlab commands give (thecomponents of x are all multiplied by 1e-2, i.e.,10 2 , in order to change from cm to m)>> x = [.001 .011 .13 .3 .75]*1e-2;>> A = [x’ (x’).^2]A =0.0000 0.00000.0001 0.00000.0013 0.00000.0030 0.00000.0075 0.0001>> format short e>> AA =1.0000e-05 1.0000e-101.1000e-04 1.2100e-081.3000e-03 1.6900e-063.0000e-03 9.0000e-067.5000e-03 5.6250e-05>> format, format compact>> b = [5 50 500 1000 2000];The second column of A is mainly zeros in standardformat and so a switch to format short25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!