 ENGINEERING COURSES FOR UNDERGRADUATE STUDENTSLECTURES & APPLICATIONS Home Calendar FAQ Search Memberlist Usergroups Register Log in

 ENGINEERING COURSES FOR UNDERGRADUATE STUDENTS :: ENGINEERING PROGRAMS/SOFT WARE :: MATLAB PROGRAM FORUM Share

Polynomials and Fitting AuthorMessage

Posts : 38
Join date : 2009-10-27
Location : UNITED STATE OF AMERICA, STATE COLLEGE,PA  Subject: Polynomials and Fitting Thu Oct 29, 2009 6:51 am Matlab can treat a vector as a polynomial. It will assume that the numbers represent the coefficients of the polynomial going from highest-order to lowest order.>>p = [1 2 2 4 1]can represent the polynomial x^4 + 2x^3 + 2x^2 + 4x + 1. There are a number of functions that use this representation of polynomials:>>roots(p)gives you the roots of the polynomail represented by the vector p.>>polyval(p,4)gives you the value of the polynomial p when x = 4. Similarly,>>polyval(p,[1:10])gives you the value of the polynomial evaluated at each of the points in the vector. (It returns another vector the same size.)You can fit polynomials to data sets using this representation and a function called curvefit.>>[p, fitted] = curvefit(x,y,n)fits the data in x and y to an nth order polynomial (using 1 gives you a straight line, 2 gives you a quadratic, etc), and plots both the data and the fitted curve for you. It returns p, the polynomial representing the equation of the fitted curve, and fitted, the data points you get from the curvefit for each of the x's in your data set.You can use polyval and the fitted polynomial p to predict the y value of the data you've fitted for some other x values.>>ypred = polyval(p,xvalues)    Polynomials and Fitting Page 1 of 1
 Similar topics » cause of rod thermostat failure
» Gurgling noise after a new Radiator was fitted
» fitting chimney tubing to metal box section

Permissions in this forum:You cannot reply to topics in this forum Jump to: Select a forum||--PRODUCTION & MANUFACTURING ENGINEERING|   |--MACHINE ELEMENT DESIGN FORUM|   |--MECHANICAL VIBERATION FORUM|   |--MACHINE DYNAMICS FORUM|   |--STATICS FORUM|   |--DYNAMICS FORUM|   |--FAULT DIOGNASIS FORUM|   |--WORKSHOP FORUM|   |--MANIFACTURING FORUM|   |--LUBERICATION FORUM|   |--SOLID MECHANICS FORUM|   |--INDUSTRIAL ENGINEERING|   |--ENGINEERING MANAGMENT FORUM|   |--ENGINEERING ECONOMY FORUM|   |--MICRO ECONOMY FORUM|   |--STATISTICS & PROBABILITY FORUM|   |--ELECTRICAL ENGINEERING FORUM|   |--FUNDAMENTAL OF ELECTRICAL CIRCUITS FORUM|   |--DIGITAL FORUM|   |--ELCTERICAL POWER FORUM|   |--MECHANICAL ENGINEERING POWER|   |--HEAT TRANSFER FORUM|   |--APPLIED OF HEAT TRANSFER FORUM|   |--MODELING& SIMULATION FORUM|   |--GAS TURBINE FORUM|   |--DESALINATION TECHNOLOGY FORUM|   |--POWER PLANT FORUM|   |--THERMODYNAMICS FORUM|   |--POWER PLANT FORUM|   |--AIR CONDITIONING AND REFRGERATION FORUM|   |--FLUID MECHANICS FORUM|   |--HEAT ENGINE FORUM|   |--ENGINEERING PROGRAMS/SOFT WARE|   |--MATLAB PROGRAM FORUM|   |--MD SOLID PROGRAM FORUM|   |--SOLID WORK FORUM|   |--ENGINEERING EQUATION SOLVER FORUM|   |--LAB VIEW PROGRAM|   |--GENERAL COURSES    |--MATHEMATICS FORUM    |--PHYSICS FORUM    |--ENGLISH FORUM