02.03.2016 Views

MATLAB by rudra pratap

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.2 Curve Fitting and Interpolation<br />

139<br />

If you know which factorization to use, then all you need to know here is the<br />

syntax of the corresponding function. If you do not know where and how these<br />

factorizations are used, then this is not the right place to learn it; look into your<br />

favorite books on linear algebra. 2<br />

5.1.5 Advanced topics<br />

<strong>MATLAB</strong>'s main strength is its awesome suite of linear algebra functions. There<br />

are hundreds of functions that aid in finding solutions to linear algebra problems,<br />

from very basic problems to very advanced ones. For example, there are more than<br />

10 eigenvalue-related functions. Type lookfor eigenvalue to see a list of these<br />

functions. Among these functions, eigs deserves special mention. This function<br />

was added in <strong>MATLAB</strong> 5 to help find just a few eigenvalues and eigenvectors, a<br />

requirement that frequently arises in large-scale problems.<br />

There is a separate suite of functions for sparse matrices and computations with<br />

these matrices. These functions include<br />

Fo r on-line help<br />

type:<br />

help sparfun<br />

Category<br />

Elementary matrix functions<br />

FUll to sparse conversion<br />

Utility functions<br />

Reordering algorithm<br />

Linear algebra<br />

Linear equations<br />

Example functions<br />

speye , sprand, spdiags<br />

sparse, full, spconvert<br />

nnz , nzmax , spalloc, spy<br />

colamd , colperm , symamd , symrcm<br />

eigs , svds , luinc , choline<br />

peg, bicg , cgs , qmr<br />

Please see the on-line help with help sparfun for a list of these functions and their<br />

brief descriptions. Detailed on-line help is available on each function.<br />

<strong>MATLAB</strong> also provides several functions for operations on graphs or trees, such<br />

as treelayout, treeplot, etree, etreeplot, gplot, etc. These functions are listed<br />

under the sparfun category.<br />

5.2 Curve Fitting and Interpolation<br />

5.2.1 Polynomial curve fitting on the fly<br />

Curve fitting is a technique of finding an algebraic relationship that "best" (in a least<br />

squares sense) fits a given set of data. Unfortunately, there is no magical function<br />

(in <strong>MATLAB</strong> or otherwise) that can give you this relationship if you simply supply<br />

the data. You have to have an idea of what kind of relationship might exist between<br />

the input data (xi) and the output data (yi)· However, if you do not have a firm idea<br />

but you have data that you trust, <strong>MATLAB</strong> can help you explore the best possible<br />

fit. <strong>MATLAB</strong> includes Basic Fitting in itH figure window's Tools menu that lets<br />

you fit a polynomial curve (up to the tenth order) to your data on the fly. It also<br />

2Some of my favorites: Linear Algebra and Its Applications <strong>by</strong> Strang, Saunders HBJ College<br />

Publishers; Matrix Computations <strong>by</strong> Golub and Van Loan, The Johns Hopkins University Press;<br />

Matrix Analysis <strong>by</strong> Horn and Johnson, Cambridge University Press.

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

Saved successfully!

Ooh no, something went wrong!