This preview shows pages 1–6. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Section 5.14: MatLab Functions
Built in MatLab function used in our previous examples: sort, max, min, std, mean To see the other data functions available: Type help datafun at >> prompt 11 Section 5.14: MatLab Functions
Previous Next MatLab function help 22 Section 5.14: MatLab Functions
Previous Next Curve fitting using MatLab function "ployfit"
Typical call format ( coef = polyfit(x,y,n)
x y n 33 = vector of x data = vector of y data = order of polynomial desired
n=1 R n=2 R etc. for a straight line quadratic fit line Returns vector (coef in examplecould be any name variable) coef= constants in the polynomial, from highest order to lowest order
coef(1) = highest power term [ coef(1)*x^n ] coef(2) = next highest power term [ coef(2)*x^(n1) ] coef(3) = next highest [ coef(3)*x^(n2) ] etc. Quadratic example: linreg.m Section 5.14: MatLab Functions Previous Next Comparing two curve fits using "polyfit"
linear fit quadratic fit 44 linreg.m is in the Chapter5 Examples folder straight line calculation quadratic line calculation doing the plots program results slope intercept
y = 0.678x  15.1 The plot quadratic coefficients y = 0.008x 2  0.482 x + 19.1 Section 5.14: MatLab Functions
Previous Next 55 End of Slide Show for Section 5.14
MatLab example done in this section linreg.m This is a good time to work on Exercise 5.14 Section 5.14: MatLab Functions
Previous Next 66 End of Slide Show for Section 5.14
MatLab example done in this section linreg.m This is a good time to work on Exercise 5.14 Section 5.14: MatLab Functions
Previous Next ...
View
Full
Document
This note was uploaded on 05/19/2008 for the course ENGR 25 taught by Professor All during the Spring '08 term at Lehigh University .
 Spring '08
 ALL
 Sort

Click to edit the document details