1Data Fitting9-18-20052Opening Discussion■What did we talk about last class?■Do you have any questions about the assignment?3Data Interpolation■Interpolation is the process of estimating values between data points. What methods does Matlab give for you to do this?■Let's play with some 1-D interpolation and see how the different methods work.42-D Interpolation■Matlab can also do 2-D interpolation with interp2. This is easy to do if you have a 2-D array of data and want to find one point.■To construct a finer mesh we need the meshgrid function that will give us an easy way to represent all points on a grid. It takes two 1-D arrays and returns two 2-D arrays.■Lets play with this as well. We can use the mesh function to plot out surfaces.■We can also try to redo our Mandelbrot in such a way that we can use the surface plotting and try to do it without loops.5Polynomials■Matlab provides a simple mechanism for us to deal with polynomials. Row arrays are can be viewed as the coefficients on polynomials.■Given this form, roots finds the roots of that polynomial.■Given the roots, poly will return the polynomial with those roots. (This one can be fairly easily done by hand.)■The conv function will multiply two polynomials.■Addition can be done easily if the polynomials have the same number of terms. Otherwise one will need to be padded with zeros.■For division use deconv.6Calculus and Evaluation■You can take derivatives of polynomials with polyder.■You can integrate a polynomial with polyint. Remember that this must be passed in a constant along with the polynomial.■The polyval function will evaluate a polynomial at one value or for an array of values.7Curve Fitting■Given data, you can use the polyfit to fit a polynomial to it. The arguments are the x and y values followed by the order of the polynomial you want back.■In general you should use lower order polynomials, they are typically better behaved.■It turns out this is just a wrapper function for solving a system of linear equations, typically a system that is overspecified.8Reminders■Assignment #3 is due tonight by midnight.■You have a quiz at the beginning of next class. The quiz will be open book and open
View Full Document