Class Notes (839,626)
United States (326,062)
ENG 6 (40)
Lecture 10

ENG 06 – Lecture 10 notes.docx

3 Pages
117 Views

Department
Engineering
Course Code
ENG 6
Professor
A H M E D R A W Y

This preview shows page 1. Sign up to view the full 3 pages of the document.
Description
ENG 06 – Lecture 10; 2/7/2013 Interpolation and Curve Fitting  Least squares regression: minimizes area between data and line you predict  polyfit: fits line to data  polyval: takes coefficients of polynomial (for example, from polyfit) and a vector of x points to evaluate at that polynomial  Regression example: linear fit o Torque needed to turn torsion spring of mousetrap through an angle is given in data points o Find constants for model given by T = k1 + k2x  >> xp=[0.698132, 0.959931, 1.134464, 1.570796, 1.919862];  >> yp=[0.188224, 0.209138, 0.230052, 0.250965, 0.313707];  >> coeffs = polyfit(xp,yp,1);
  >> xfit=[0.6:0.01:2];yfit = polyval(coeffs,xfit);  >> plot(xp,yp,'O'); hold on; plot(xfit,yfit); hold off;  >> coeffs  coeffs = 0.0961 0.1177  Interpolation or Regression? o For acceleration/velocity/distance problems, need to differentiate and integrate o Best to fit a known function that can be “easily differentiated or integrated o Use a spline fit  physics of gravity tells us that it should follow a smooth curve  Gives us just one function to work with  Fitting to More complicated functions o Linearizing: making a few substitutions for variables which result in an equation for a line  Linear vs. Nonlinear fitting o Linear in terms of fitting constants:  Y = a + bt  Y = a + bt + ct^2  y = asin(t) + bcos(t)  y = asin(3t)  y = ae^-t o Not linear in terms of all the fitting constants  y = asin(bt) + ccos(dt)  y = asing(bt)  y = ae^-bt  Linearizing Commonly Found Nonlinear functions o Log functions:
 y = Klog(x) + c  Looks like a straight line when you plot y values vs. log of x values  plot(log(x),y)  also semilogx(x,y)  creates a logarithmic x axis o Exponential functions: y = Ce^Kx  Plot log of y values vs. x values to make it look like a straight line  plot(x,log(y))  can also use semilogy(x,y)  creates an exponential y axis
More Less
Unlock Document

Only page 1 are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit