HW8 - ) Pankaj Karna pk4534 PART I 1]

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Pankaj Karna pk4534 4] x=linspace(-1,1,11); y=1./(1+25*x.^2); p=polyfit(x,y,10); xx=linspace(-1,1); yy=1./(1+25*xx.^2); zz=polyval(p,xx); i=1:11; xc=cos((2*i-1)*pi/2/11); yc=1./(1+25*xc.^2); pp=polyfit(xc,yc,10); cx=linspace(-1,1); cy=1./(1+25*cx.^2); zc=polyval(pp,cx); plot(x,y, '*' ,xx,yy, 'b' ,xx,zz, 'r' ,cx,zc, 'k' ); xlabel X ylabel Y legend( 'Data points' , 'Actual function' , 'Interpolating polynomial' , 'Chebyshev polynomial' ); title( 'Runges Phenomenon' )
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Pankaj Karna pk4534 5] x = linspace(-1,1,11); y =1./(1+25*x.^2); xi = linspace(-1,1); yi =1./(1+25*xi.^2); yi1 = interp1(x,y,xi, 'linear' ); yi2 = interp1(x,y,xi, 'spline' ); yi3 = interp1(x,y,xi, 'cubic' ); plot(x,y, '*' ,xi,yi, 'b' ,xi,yi1, 'r' ,xi,yi2, 'g' ,xi,yi3, 'k' ) legend( 'Data points' , 'actual function' , 'linear interpolation' , 'cubic spline interpolation' , 'cubic Hermite interpolation' ); xlabel X ylabel Y title( 'Piecewise Interpolation'
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ) Pankaj Karna pk4534 PART I 1] x=[30000,45000,60000,75000,90000,120000]; y1=[5.6,8.5,11.1,14.5,16.7,22.4]; line1=polyfit(x,y1,1); xfit=30000:1:120000; yfit1=polyval(line1,xfit); y2=[5,12.3,21,32.9,47.6,84.7]; line2=polyfit(x,y2,2); yfit2=polyval(line2,xfit); plot(x,y1, '*' ,xfit,yfit1, 'r-' ,x,y2, 'o' ,xfit,yfit2, 'k-' ) legend( 'thinking component' , 'thinking function' , 'braking component' , 'braking function' ); xlabel X ylabel Y title( 'Linear Regression' ) Pankaj Karna pk4534 >> yfit1=polyval(line1,104607.36); >> yfit2=polyval(line2,104607.36); >> d=yfit1 + yfit2 d = 83.9126 d is the total distance estimated for stopping a car travelling at 65mph(104.6 km/h) in meters. So the distance in feet is-d= 83.9126*3.2808399 =275.3 ft...
View Full Document

This note was uploaded on 01/20/2010 for the course ASE 311 taught by Professor Kraczek during the Spring '08 term at University of Texas at Austin.

Page1 / 4

HW8 - ) Pankaj Karna pk4534 PART I 1]

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online