CS1371 Introduction to Computing for Engineers - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

CS1371 Introduction to Computing for Engineers

Description:

Homework: Now due Monday night (midnight) October 31 - BOOH! ... Fitting parabola OK when data is well behaved. 4. Data Problems. Real data is typically ugly ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 8
Provided by: david3049
Category:

less

Transcript and Presenter's Notes

Title: CS1371 Introduction to Computing for Engineers


1
CS1371Introduction to Computing for Engineers
  • Numerical Computing
  • Interpolation

2
Administrivia
  • Homework Now due Monday night (midnight)
    October 31 - BOOH!
  • Exam WED NOV 2!!
  • Through images (I am pretty sure!)
  • Reading
  • Numerical computing - Smith, Chapter 20

3
Trajectory through Computation
  • Interpolation essentially curve fitting
  • Integration and Differentiation
  • Computing Solutions (not in book)
  • Zeros
  • bracketing
  • Newton's (with care)
  • Find Max
  • Bracketing
  • Fitting parabola OK when data is well behaved

4
Data Problems
  • Real data is typically ugly
  • Problem 1 Sparse only a few points
  • Interpolation
  • Not so smart NN, linear
  • Splines real actual pieces of metals

5
Data interpolation
  • x 0.54pi
  • y sin(x) sin(2x)/2
  • plot(x,y,'bo-') - shows linear
  • Now assume have only the points, but not the
    function
  • xx 0.14pi finer sampling
  • yy interp1(x,y,xx)
  • hold on
  • plot(xx,yy,'r')
  • zoom in looks the same! Interp1 does linear by
    default
  • yyy interp1(x,y,xx,'spline')
  • plot(xx,yyy,'b')
  • ytrue sin(xx) sin(2xx)/2
  • plot(xx,ytrue,'g')
  • better, is it more accurate?
  • doc interp1 and doc spline

6
More Problems
  • Problem 2 Noisy Data
  • Don't really want to exactly fit to the points
  • Example miles per gallon
  • Real question what is the "best fit"
  • 'polyfit(x,y,n)' minimizes "squared error"
  • n is "degree" of the polynomial
  • Splines go through sparse data (knot points)
    curve fitting approximates data (handles noise)

7
Polyfit
  • x 05
  • fine_x 0.15
  • y 0 20 60 68 77 110
  • for order 25
  • y2polyval(polyfit(x,y,order), fine_x)
  • subplot(2,2,order-1)
  • plot(x, y, 'o', fine_x, y2)
  • axis(-1 7 -20 120)
  • ttl sprintf('Degree d Polynomial Fit', order
    )
  • title(ttl)
  • xlabel('Time (sec)')
  • ylabel('Temperature (degrees F)')
  • end
Write a Comment
User Comments (0)
About PowerShow.com