To: Professor Avtable Date: February 4, 3 From: Mechancal Student Subject:.3 Experment # Numercal Methods Usng Excel Introducton Mcrosoft Excel s a spreadsheet program that can be used for data analyss, ncludng lnear regresson, numercal dfferentaton and numercal ntegraton. Data was provded by the nstructor and dfferent procedures were performed to demonstrate these functons. In the second assgnment, Excel s regresson tool was used to fnd the best-ft lne through several data ponts. Numercal ntegraton was used to determne the RMS value of a snusodal wave n the thrd assgnment. In the fourth secton, measured dsplacement data was dfferentated twce to obtan the acceleraton of an object. In the ffth assgnment, acceleraton data for an object was ntegrated twce to determne dsplacement, and ths was compared wth the measured dsplacement values. In the sxth assgnment, numercal ntegraton and dfferentaton were performed on sne and cosne waves. Fnally, n the seventh secton, two snusodal waves were summed, and the resultng wave was then dfferentated to obtan the acceleraton. Objectves The objectve of ths lab was to become famlar wth the basc data analyss that can be performed wth Excel. Also, the accuracy of numercal ntegraton and dfferentaton, and the factors whch nfluence accuracy, are studed. Dscusson The three prmary technques used n ths lab were lnear regresson performed by least squares curve fttng, numercal dfferentaton, and numercal ntegraton. Lnear regresson s used to fnd an equaton for a straght lne, of the form y = ax b () whch best fts gven data. Usng the least squares method, the slope a s gven by ( x )( y ) ( x ) n x y a = n x, () and the y-ntercept, b, s gven by
( x )( x y ) ( x ) x y b =. (3) n x An ndcaton of how well the lne fts the data s the R-squared value, where r SSE =, (4) SST and [ y f ( x )] SSE = n, (5) = [ ] y y n SST =. (6) = A value of r near. ndcates a good ft to the data. Numercal dfferentaton s used to dfferentate data consstng of dscrete data ponts where the equaton of the functon s not known. In ths experment, frst forward dfferentaton, frst central dfference, and second forward dfferentaton were used. The frst forward dfferental s gven by the frst central dfference s y y y slope = =, (7) x x x
3 x x y y x y slope = =, (8) and the second forward dfference s ( ) = = x x x x y y y d y dx y d. (9) Smlarly, numercal ntegraton s used to fnd the ntegral of data consstng of dscrete data ponts. In ths lab the trapezodal rule was used, where ( ) x x y y I I =. () Concluson Excel was used for basc numercal analyss of gven data, showng how t can be used to perform technques such as lnear regresson, usng the Data Analyss package, as well as numercal ntegraton and dfferentaton. The factors whch nfluence the accuracy of these were also consdered, fndng that the accuracy and the resoluton of the orgnal data are the most sgnfcant. These fndngs can then be used when dong future data collecton and analyss n order to mprove the accuracy of the results. References ME.3 Laboratory Experment # handout: Numercal Methods Usng Excel Avtable, P. ME.3 notes: Numercal Methods and Quantfyng Electrcal Energy.
Appendx A: Post lab questons and answers. How well dd the least squares data ft the orgnal measured data n assgnment #? Support conclusons for ths queston wth two separate approaches. The lnear regresson produced a lne whch s an excellent ft of the gven data, as s seen both by vsual nspecton, and by the R-squared value,.9984, whch s very close to the deal value of... Plot flow meter calbraton data ncludng legends for both measured and least squares ft data. Least squares regresson lne ft plot Flow rate (cubc feet per second) 8 6 4 y = 3.77x.7.5.5.5 3 Output of turbne flow meter (Volts) flow rate Predcted flow rate Fgure A-: Lne ft plot for assgnment # 3. What s the RMS value of the sne wave generated n assgnment #3? RMS =.777 A-
4. Plot the sne wave wth approprate ttles. Sne wave.5 Ampltude.5 -.5 - -.5 3 4 5 6 7 Tme Fgure A-: Sne wave generated for assgnment #3 5. Dscuss the method used to determne the velocty and acceleraton from dsplacement data n assgnment #4. What errors are assocated wth numercal dfferentaton and how may they be reduced? The dsplacement data was numercally dfferentated n order to determne the velocty and acceleraton. In numercal dfferentaton, the slope between two data ponts s calculated, gvng an approxmaton of the dervatve of the functon at that locaton. Snce the slope s beng found between two ponts, as opposed to fndng the true tangent to the functon at that pont, there s an nherent error n the result. The technque s also hghly senstve to errors n the orgnal data, these are amplfed by the numercal dfferentaton. For example, f the data ponts fall approxmately along a straght lne, but ndvdual ponts fall above or below the lne, these varatons wll result n greatly varyng values for the slope. Ths was clearly shown n the result from ths porton of the experment, partcularly wth the second dervatve, n whch the errors are amplfed even more than n the frst dervatve. These errors can be reduced by ncreasng the number of data ponts. A-
6. Generate separate plots of dsplacement, velocty, and acceleraton data determned n assgnment #4. Dsplacement Dstance (ft).8.6.4..8.6.4..5..5..5.3 Tme (sec) Dstance Fgure A-3: Gven dsplacement data for assgnment #4 Velocty Velocty (ft/sec) 4 8 6 4.5..5..5.3 Tme (sec) Velocty Fgure A-4: Calculated velocty for assgnment #4 A-3
Acceleraton 5 Acceleraton (ft/sec^) 5 5-5 - -5.5..5..5.3 Acceleraton - Tme (sec) Fgure A-5: Calculated acceleraton for assgnment #4 7. Dscuss the method used to determne the dsplacement of the vbratng pont of a structure n assgnment #5. How well dd the ntegrated acceleraton data correlate wth the measured dsplacement data? The acceleraton data was numercally ntegrated twce to fnd the velocty and poston of the object. Numercal ntegraton, n whch small elements of the area under the curve are summed to approxmate the total area under the curve, s much less senstve to small errors n the data ponts. Unlke dfferentaton, numercal ntegraton requres that ntal condtons are known. Smlar to dfferentaton, the accuracy of the result can be mproved by ncreasng the resoluton of the data. The derved poston data correlated very well wth the measured data. The two curves are most closely algned at the begnnng of the tme range, and as the tme ncreases the small errors n the derved poston accumulate to produce a greater dfference between the derved and measured postons. A-4
8. Plot the LVDT data and dsplacement data obtaned from the ntegraton of acceleraton measurement. Comparson of Measured and Calculated Poston.5.4.3. Poston (ft). -..5..5..5 Poston (measured) Poston (calculated) -. -.3 -.4 -.5 tme (sec) Fgure A-6: Comparson of measured LVDT data and derved dsplacement data 9. Is numercal ntegraton less subject to the effects of random nose than numercal dfferentaton, based on your results n assgnment #4 and #5? Justfy your answer. Yes. Ths s clearly shown by the fact that the calculated velocty and acceleraton data from assgnment #4 has greatly amplfed the error n the orgnal data, whle the calculated poston from assgnment #5 s very close to the measured poston. Wth numercal ntegraton, each ndvdual data pont has a smaller nfluence on the resultng functon than wth numercal dfferentaton.. Compare and dscuss the results from assgnment #6 and note any dfferences that were observed for both the degree and degree evaluatons. In ths part the orgnal sgnal was compared wth the calculated sgnal, and t can be easly seen that ncreasng the resoluton of the data ncreases the accuracy of the numercal ntegraton. When the number of data ponts was ncreased by a factor of ten, the resultng sgnal was vrtually dentcal to the orgnal sgnal.. Compare and dscuss the sgnals n assgnment #7. Compare both the summed dsplacement and acceleraton sgnals. When comparng the dsplacement and acceleraton sgnals, dentfy why there s such a sgnfcant change n the general shape of the sgnal. As expected, the summed wave had the same general shape as the larger ampltude Hz sgnal, but ncorporated the hgher frequency changes of the Hz sgnal. In the acceleraton sgnal, found usng numercal ntegraton, the hgher frequency up-anddown acceleraton of the Hz sgnal domnated that of the Hz sgnal. A-5
Appendx B: Detals of assgnment #: Least squares regresson In ths secton, data n the fle lab-a.xls, the output of a turbne flow meter, was analyzed. A lnear regresson, usng least squares curve fttng as descrbed n the Dscusson secton, was performed on the data to fnd the best ft lne through the gven data ponts. The Data Analyss tool n Mcrosoft Excel was used. Table B- s the summary of the analyss generated by Excel. The equaton found for the best-ft lne s y = 3.77x.7. (B-) Table B-: Summary of regresson analyss SUMMARY OUTPUT Regresson Statstcs Multple R.99977 R Square.99845485 Adjusted R Square.9988368 Standard Error.3779337 Observatons ANOVA df SS MS F Sgnfcance F Regresson 9.684 9.6 585.68 5.7999E-4 Resdual 9.696548.9 Total 9.769699 Coeffcents Standard Error t Stat P-value Lower 95% Upper 95% Lower 95.% Upper 95.% Intercept.7994.77498.39.976 -.67745.835 -.677458.83497 output 3.778359.48637 76.6 5.8E-4 3.5975357 3.8757 3.5975357 3.87566 RESIDUAL OUTPUT Observaton Predcted flow rate Resduals.96485 -.96485.4346.5976954 3.378844.96756 4 3.33943.667577 5 4.56753 -.356753 6 4.96347.93986593 7 5.885593865.744635 8 7.44864468 -.44864468 9 7.9895657 -.95657 9.94959 -.94959 9.9584839.45969 B-
The plot of both the gven data ponts and the best-ft lne are shown n Fgure B-. Least squares regresson lne ft plot Flow rate (cubc feet per second) 8 6 4.5.5.5 3 Output of turbne flow meter (Volts) flow rate Predcted flow rate Fgure B-: Lne ft plot for assgnment # B-
Appendx C: Detals of assgnment #3: Root mean square determnaton of a sne wave A sne wave, shown n fgure C-, was generated, wth data ponts between the x- values of and π. Sne wave.5 Ampltude.5 -.5 - -.5 3 4 5 6 7 Tme Fgure C-: Sne wave The RMS value, or equvalent DC voltage, of a snusodal AC sgnal, s gven by T RMS = y (t)dt, (C-) T where T s the perod and y(t) s the ampltude of the sne wave, whch s a functon of tme. The ntegral n equaton C- was calculated usng numercal ntegraton wth the trapezodal rule, as descrbed n the Dscusson secton of ths report. The RMS value of the wave was found to be.777. C-
Appendx D: Detals of assgnment #4: Numercal dfferentaton The data n the fle Lab-B.xls s expermental measurements of the dstance traveled by an object fallng freely under gravty. Ths measured dsplacement data, shown n fgure D-, s numercally dfferentated twce, usng the central dfference method, to calculate the velocty and acceleraton of the object. These are shown n fgures D- and D-3. Dsplacement Dstance (ft).8.6.4..8.6.4..5..5..5.3 Tme (sec) Dstance Fgure D-: Measured dsplacement of fallng object Velocty Velocty (ft/sec) 4 8 6 4.5..5..5.3 Tme (sec) Velocty Fgure D-: Calculated Velocty of fallng object D-
Acceleraton 5 Acceleraton (ft/sec^) 5 5-5 - -5.5..5..5.3 Acceleraton - Tme (sec) Fgure D-3: Calculated acceleraton of fallng object D-
Appendx E: Detals of assgnment #5: Numercal ntegraton The fle Lab-C.xls contans data on the tme, dsplacement, and acceleraton of a pont vbratng on a structure. Ths acceleraton was ntegrated twce usng the trapezodal rule to fnd the dsplacement, and ths calculated dsplacement s compared to the measured dsplacement data. Intal data s needed for the numercal ntegratons, and an ntal velocty of.6 ft/sec (gven) and ntal dsplacement of.644 ft (measured) were used. The comparson of the measured and calculated dsplacements s shown n fgure E-. Comparson of Measured and Calculated Poston.5.4.3. Poston (ft). -..5..5..5 Poston (measured) Poston (calculated) -. -.3 -.4 -.5 tme (sec) Fgure E-: Comparson of measured and calculated poston data E-
Appendx F: Detals of assgnment #6: Dfferentaton and ntegraton of a sne and cosne A sne wave s generated wth degree ncrements. Ths sne wave was then numercally dfferentated usng the central dfference method, and the resultng sgnal was numercally ntegrated wth the trapezodal rule to obtan the orgnal sgnal. These two sgnals are shown n fgure F-. Comparson of orgnal sgnal and calculated sgnal, degree ncrements.5.5 -.5 4 6 8 Orgnal sgnal Calculated sgnal - -.5 Fgure F-: Orgnal and derved sne waves, degree ncrements Ths procedure was then repeated wth degree ncrements, n order to show the mproved accuracy whch can be acheved by ncreasng the resoluton of the data. These two sgnals are shown n fgure F-. F-
Comparson of orgnal and calculated sgnals, degree ncrements.5.5 -.5 4 6 8 Orgnal sgnal Calculated sgnal - -.5 Fgure F-: Orgnal and derved sne waves, degree ncrements F-
Appendx G: Detals of assgnment #7: Dfferentaton of two summed, ndependent sne waves Two snusodal sgnals were generated. The frst was a Volt p-p sne wave at Hz, and the second a. Volt p-p sne wave at Hz, and both were generated for one second. They are plotted n fgure G-..6 Comparson of snusodal sgnals Volts.4. -. -.4 -.6 3 4 5 6 7 Tme V p-p sgnal at Hz. V p-p sgnal at Hz Fgure G-: Hz and Hz sne waves These two sgnals were then added, as shown n fgure G-. Combned sgnal Volts.6.4. -. -.4 -.6 4 6 8 Tme Combned sgnal Fgure G-: Combned sgnal G-
Ths summed sgnal was then dfferentate twce, usng the forward dfference method, to obtan acceleraton, as shown n fgure G-3. Second dervatve of combned sgnal Acceleraton 8 6 4 - -4-6 -8 4 6 Tme Acceleraton Fgure G-3: Second dervatve of combned sgnal, acceleraton G-