Chapter19 - Problem 19.11 The following data was collected...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Problem 19.11 The following data was collected for the distance travelled versus time for a rocket: t, sec. y, km 0 0 25 32 50 58 75 78 100 92 125 100 Use numerical differentiation to calculate velocity and acceleration at each time. At time t=0, we can calculate the velocity by forward differences v=(320)/(250)=1.28 km/s. We can also use a three point forward difference equation f '( x) f ( x 2h) 4 f ( x h) 3 f ( x) 58 4 32 3 0 1.4 2h 50 We can also fit a quintic polynomial to the data and take its derivative at zero >> t=[0:25:125] t = 0 25 50 75 100 125 >> y=[0 32 58 78 92 100] y = 0 32 58 78 92 100 >> p=polyfit(t,y,5) Warning: Polynomial is badly conditioned. Add points with distinct X values, reduce the degree of the polynomial, or try centering and scaling as described in HELP POLYFIT. p = 0.0000 0.0000 0.0000 0.0048 1.4000 0.0000 >> format short e >> p p = 3.0478e022 1.0186e019 1.2065e017 4.8000e003 1.4000e+000 7.2060e015 Which means that the data fits very well a quadratic polynomial >> v0=p(5) v0 = 1.4000e+000 We verify that a quadratic polynomial will do >> p=polyfit(t,y,2) pq = 4.8000e003 1.4000e+000 9.6598e015 For the velocity at t=25, we can use twopoint forward differences (5832)/25=1.04, twopoint backward differences (320)/25=1.28 twopoint centered differences (580)/50=1.16 (which is the average of the backward and forward differences), or we can use the threepoint forward differences f '( x) f ( x 2h) 4 f ( x h) 3 f ( x) 78 4 58 3 32 1.16 2h 50 The fact that the threepoint forward difference gives the same result as the centered differences confirms the fact that the data is derived from a quadratic polynomial. If we use the Matlab function gradient we can get the velocities everywhere >> vel=gradient(y,25) vel = 1.2800e+000 1.1600e+000 9.2000e001 6.8000e001 4.4000e001 3.2000e001 It uses the centered differences at all points except the ends where it uses twopoint forward differences (first point) and twopoint backward differences (last point). We can apply once again for the acceleration acc = 4.8000e003 7.2000e003 9.6000e003 9.6000e003 7.2000e003 4.8000e003 We see that the gradient function is inaccurate for the two extreme points for the velocity, but for the acceleration, two points on each ends are less accurate. To see the effect of noise we contaminate the distance measurements with normally distributed errors with standard deviation of 1 km. >> yerr=randn(1,6) yerr = 4.3359e001 3.4262e001 3.5784e+000 2.7694e+000 1.3499e+000 3.0349e+000 >> ytot=y+yerr ytot = 4.3359e001 3.2343e+001 6.1578e+001 8.0769e+001 9.0650e+001 1.0303e+002 We calculate the velocity again from using the gradient function >> vtot=gradient(ytot,25) vtot = 1.3110e+000 1.2402e+000 9.6854e001 5.8143e001 4.4531e001 4.9539e001 Compare to the original calculation vel = 1.2800e+000 1.1600e+000 9.2000e001 6.8000e001 4.4000e001 3.2000e001 With the maximum difference of 0.18 km/sec. We next calculate acceleration with the gradient again >> acctot=gradient(veltot,25) acctot = 2.8324e003 6.8502e003 1.3176e002 1.0465e002 1.7208e003 2.0033e003 Compared to the original acceleration acc = 4.8000e003 7.2000e003 9.6000e003 9.6000e003 7.2000e003 4.8000e003 Now the differences are large. Recall that the true acceleration without noise or differentiation errors is 0.96e003. We can filter out noise and reduce the finitedifference approximations by fitting the data with a quadratic polynomial >> ptot=polyfit(t,ytot,2) ptot = 5.1251e003 1.4537e+000 1.7187e001 Compare with the noisefree fit pq = 4.8000e003 1.4000e+000 9.6598e015 The error in the coefficients are much smaller than the errors in the data. Ptot(3)=0.17187 is the position at t=0. With the noise we measured 0.43359, but the fit reduced the error by more than a factor of two. Ptot(2)=1.4537 is the speed at t=0. The true value is pq(2)=1.4, finite difference from the noisefree data gave us 1.28, and with the noise we got 1.311. So again the fitted result is more accurate. 2*ptot(3)=1.025e002 is the acceleration throughout the trajectory. The true value is 9.6e003, so that the error is about 7%. However, the gradient value range from 2e003 (wrong sign) to 1.3176e002, which 35% too high. ...
View Full Document

Ask a homework question - tutors are online