O'Reilly logo

Excel Scientific and Engineering Cookbook by David M Bourg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8.1. Performing Linear Curve Fitting Using Excel Charts

Problem

You'd like to generate a best-fit straight line for a set of data.

Solution

Use Excel's chart trendline feature to perform a linear curve fit of your data. Plot your data using an XY scatter chart (see Chapter 4). Once your chart has been created, right-click on the data series and select Add Trendline from the pop-up menu.

Discussion

Linear curve fits are easily generated using the trendline feature built into Excel's XY scatter chart. Once you've plotted your data using an XY scatter chart, you can generate a trendline that will be displayed on your chart, superimposed over your data. You can also include the resulting equation for the best-fit line on your chart.

Consider the data shown in Table 8-1. This data represents experimentally obtained angular deflections of an angular spring resulting from prescribed applied torques.

Table 8-1. Angular spring data

Applied torque

Measured deflection

(N-m)

(degrees)

-1.993

-1.547

-1.411

-1.178

-1.440

-1.167

-0.443

-0.318

-0.428

-0.416

-0.444

-0.327

0.016

-0.035

0.013

0.032

0.049

0.036

0.830

0.762

0.854

0.687

0.851

0.698

1.730

1.412

1.703

1.399

1.698

1.419

2.044

1.675

2.063

1.624

2.034

1.627

This data should exhibit a linear trend when plotted. (Assuming the spring obeys Hooke's law.) Indeed this is the case, as is revealed by plotting this data on an XY scatter chart. Once that chart has been created, right-click on the data series ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required