1. Trang chủ
  2. » Công Nghệ Thông Tin

A Guide to Microsofl Excel 2002 for Scientists and Engineers phần 4 pps

33 330 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 33
Dung lượng 1,01 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

88 A Guide to Microsoft Excel 2002 for Scientists and Engineers 16 lSum of 3 largest Exercise I O : Array Formulas 30 I OR do not act in the expected way when used in array formulas-

Trang 1

88 A Guide to Microsoft Excel 2002 for Scientists and Engineers

16 lSum of 3 largest

Exercise I O : Array

Formulas

30 I

OR do not act in the expected way

when used in array formulas- they

always return a single value, never

an array

For more array-formula examples

including interesting uses of OR

You may wish to review Exercise 8 of Chapter 4 before continuing For example, have you remembered that we must use

I5J+[aJ+[W] to complete an array formula entry?

To investigate array formula we will imagine we have some data and we need the following quantities: (i) sum of the cubes, (ii) a count of how many values lie in a ceratin range (let this be 5 to IO), (iii) the sum of the squares of values that lie within that range, and (iv) the sum of the N largest values Generally one would use an

array formula only with a large data set but it is more convenient

to demonstrate it on a small set to show how one can check that the array formula has been constructed correctly

(a) Set up a worksheet as shown in Figure 5.12 Enter the values

in A2:AlO and name this range as data

(b) In row 2 enter these formulas and copy them down to row 10:

B2: =A2"3

C2: =IF(AND(A2>=5), A2<=10, 1,O) D2: =IF(AND(A2>=5), A2<=10, A2"2,0)

Trang 2

In row 11, use the SUM function to sum the B, C and D

columns

(c) Now we see that we can obtain these summations without the intermediate data The formulas in the lower part of the sheet are:

LARGE(data,2) + LARGE(data,3) However, had we wanted the sum of the 10 largest, an array formula would have been more convenient

It is instructive to investigate how Excel performs these calculations Read all of the next step before you proceed

(d) Select C13 and in the formula bar use the mouse to select the

dutaA3 portion of the formula Press IF9] to calculate this

part of the formula Excel responds by displaying

=SUM((8;27;125;216;1000;1331;729;216;125}) Excel has generated an array in which each item is the cube of the

corresponding item in the data range Press to undo the evaluation; use the Undo tool if you forget to do this Experiment with portions of the other formulas

Users of Excel XP have access to a tool that performs these evaluations more conveniently Make C15 the active cell and use the command ToolslFormula AgditinglEvaluate Formula

Click the Evaluate button on the dialog box and observe the

result in the window After four evaluations we will have

=SUM({FALSE; FALSE;TRUE;TRUE;TRUE;TRUE;TRUE; TRUE;TRUE)*{TRUE;TRUE;TRUE;TRUE;TRUE;FALSE; TRUE;TRUE;TRUE)*dataA2) The seventh evaluation gives

=SUM({O;O;1;1;1 ;0;1;1;1)*(49;9;25;36;100;121;81;36;25}) The next evaluation gives =SUM({0;0;25;36;100;0;81;36;25})-note

how this matched the data in D2:DlO Finally we get the result

303

Trang 3

90 A Guide to Microsoft Excel 2002 for Scientists and Engineers

To compute the value of sin(x)/x, a student uses =SIN(Al)/Al

However, this will not give the correct value of 1 when A1 has

a value of zero Correct the formula

Simplifl the formula in 1 above using AND twice

This problem is for electrical engineers (a) Using IF functions without AND or OR, show that the output (F) in the voter circuit below is YES (1) only when the majority of the inputs are YES (b) Can you suggest a method using AND and OR without IF?

Trang 4

6 Textbooks on numerical computing quite correctly warn ofthe round-off errors that can occur when subtracting two numbers that are very close in size When the traditional method is used

to solve a quadratic equation where b2 >> 4ac, the root of smallest magnitude is found by subtracting from b a number

that differs little from it To avoid this, we first find the

quantity Q = -(b+sign(b) x sqrt(b2 - 4ac))D, and then compute the roots as x1 = Q/a and x2 = c/Q

and B9 such that B8 contains the numerically larger root to facilitate comparison with the alternative method

5

8 Root 1 -2.56000000E+02 Test 1 -2.2422E-12 Root 1 -2.56000000E+02 Test 1 -2.2422E-12

9 Root 2 -4.88282126E-09 Test 2 -2.2421E-12 Root 2 -4.88281250E-09 Test 2 0.0000E+OO

-

Trang 6

Charts

Concepts

Types of Charts

This chapter shows how to create graphs from data in a worksheet

So why does the chapter have the title Charts? Whereas business people show charts at their meetings, scientists and engineers use graphs to display their data The term you use depends on your occupation but the object is the same Since the largest market for Microsoft Excel is the business world, it uses the term charts We will do the same so that you will remember to look under this term

in the Help facility

Microsoft Excel offers the user some 300 chart formats including Line, XY (Scatter), Column, Bar and Pie charts Some of the chart types are shown in Figure 6.1 We concentrate on XY charts since these are generally the most useful for scientists and engineers When you have mastered this chapter, you will be able to create charts of other types with a little experimentation

Figure 6.1

Line and XY (Scatter) Many Excel beginners are confused by the two terms Line chart

and XY (Scatter) chart Let us agree to drop the scatter part of the name; this is a term from statistics and generally has no meaning

to the scientific or engineering users The diagrams in Figure 6.1

Charts

Trang 7

94 A Guide to Microsoft Excel 2002 for Scientists and Engineers

add to the confusion about a Line and an XYchart Both types are

capable of displaying their data in line or marker format Indeed,

we shall see that you can use both lines and markers in a chart

A Line chart is generally used when the x-values are textual (days

of the week, names of companies, places, etc.) Furthermore, even when the x-values in a Line chart are numbers, they are treated as text Each x value is placed one after the other on the x-axis, regardless of value It takes practice to make a Line chart with numeric x-values since Excel will think there are two y-value ranges The trick is to make an XY chart first and convert it to a Line chart By default, the data points are between the tick marks

on the x-axis but this can be changed

Moral: When the x-values are

rw-mk YOU normally require an

XY chart

In Figure 6.2 we have charts produced from two data sets The XY and Line charts made from the first set are very similar but observe the difference when the x-values have non-regular intervals

Trang 8

You know that the x-axis is the horizontal axis while the y-axis is vertical You are also familiar with the terms titles, legends and gridlines However, the terms chart area and plot area may be

new Their meaning is demonstrated in Figure 6.3 Collectively, these items are called objects The chart area is everything within

the border The plot area is everything other than the titles and legend In this chart, the plot area has a pattern If you do not need the pattern you must set pattern to None, as is explained in a later exercise Gridlines are optional; you may include vertical and/or horizontal gridlines

Markers and lines

The data in this chart is plotted with both markers and a line You

may opt to have one or both of these You can also specify neither markers nor line in which case the data disappears! The colour of each may be specified separately There are a number of styles (e.g solid or dotted) and width options for the line Similarly, the shape of the markers may be changed The scale (maximum and minimum values) of each axis may be changed, and there are

Trang 9

96 A Guide to Microsoft Excel 2002 for Scientists and Engineers

options to change the number and placement of the tick mark on each axis

Smoothing Option One of the options for changing the appearance of a chart is

smoothing This option may be selected as the chart is made or later using either the Chart type or the Format Data Series dialog

In most cases we will want to smooth our data but there may be occasions when it is inappropriate to smooth experimental data Figure 6.4 shows the effect of this option when plotting the functiony = 3x2 + 4 You may wish to experiment with this feature when working through the exercises

in the next chapter

Exercise 1 : Creating In this exercise we will create an XY chart Figure 6.5 shows the

data we will plot and the chart that will result

(a) Start a new workbook In the range A 1 :B6 type the data shown

Trang 10

(c) In Step 1 of the Chart Wizard (Figure 6.6) we specify the type

and subtype of chart For this exercise we require an XY type chart For the subtype, select chart with smoothed lines and markers Press the Press and Hold to View Sample button to get a thumbnail sketch of how the chart will appear

(d) Click the Next button to bring up Step 2 as shown in Figure

6.7 Generally, one need do nothing in Step 2 except press the next button

Trang 11

98 A Guide to Microsoft Excel 2002 for Scientists and Engineers

column as the title Click in the Title box and make the title

Graph I Add the two axes titles

Figure 6.8

Trang 12

when dragging a chart,

be moved parallel to

column or the row

Holding down

chart is aligned with

when it i s moved or resize

'tricks' help when

align several charts

chart is outlined in colour-coded

rangefinders - see Figure 6.10

(f) Open the Gridline tab of the dialog box and click the

appropriate boxes to remove all gridlines If you have jumped ahead to Step 4, use the Back button to return to Step 3 Now

open the Legend tab and click the box to remove the legend A

legend is redundant when there is only one data series

Figure 6.9

(g) Use the Next button to proceed to Step 4 (Figure 6.9) It is here that we may specify if the chart is to be embedded in the worksheet or to be placed on a separate chartsheet We will opt

for the former Press Finish to complete the Chart Wizard

At this point the chart is displayed with eight solid boxes

(handles) around its border When they are showing, we speak

of the chart as being selected or activated

A Chart toolbar is probably visible If not, use YiewlToolbars and click on Chart so that this toolbar appears whenever a chart is selected We will use this in the next exercise

Trang 13

I O 0 A Guide to Microsoft Excel 2002 for Scientists and Engineers

(h) In all likelihood, you will be disappointed with the product Do not despair, it can quickly be made very acceptable If the handles are absent, click just inside the chart

Hold down the mouse button and drag the chart to the desired position Pull any of the handles to resize the chart

Click on the inner border (the border of the plot area) and it will display handles Carefully drag the handles in the centre

of the bottom and top borders (Figure 6.10) to improve the appearance of the chart The maximum x-axis value will be 5

or 6, depending on what size you make your chart We will see how to specify a constant value in the next exercise

Exercise 2: We saw at the end of Exercise 1 how to change the position of a

chart, and size of the chart and the plot areas In this exercise we will make other changes to the chart created in that exercise The process of altering the appearance of objects on a chart is called formatting

Modifying a Chart

1 Format Plot Area

By default, Microsoft Excel gives the plot area a grey shaded background While this looks fine on the screen, generally it is less pleasing on a printed page We will remove this so that the plot area has the same appearance as the chart area

(a) Click anywhere within the plot area If you are not sure that you have the correct area, let the mouse rest for a few seconds and a screen tip displaying Plot Area will appear If you can see the Chart toolbar, click on the Format Plot Area tool as shown in Figure 6.1 1 Otherwise, use the menu command

- FormatlSelected Plot Area to bring up the Format Plot Area dialog box as shown in Figure 6.12

&-mat Plot Areal I

Figure 6.11

(b) Click on the None radio button within the Area region of the dialog box

Trang 14

(c) Before clicking the OK button you may wish to explore the

options that appear when you use the Fill Effects button

Figure 6.12

2 Format Data Series

Perhaps you would prefer hollow circles rather than solid diamond shapes used for the markers or you may wish to have no markers Maybe you would like to have a dotted line or you may wish to have no line joining the markers

To format a data series we could begin by clicking on the line

or a marker of the data series and proceeding as before Instead, we will right click on the line or one of the markers to

activate a popup menu The first item should be Format Data

Series If it is Format Data Point, you have mistakenly clicked

twice and will need to click elsewhere and start again The Patterns tab of the Format Data Series dialog box is shown

in Figure 6.13 There is one area for the line and another for

the markers Click the radio button next to None to remove

either the line or the marker Use the pull down arrow next to

Style to change the type of line or the shape of the markers Similarly the colour used for either the line or the markers may

be changed To get hollow markers make the background

colour white The Size value sets the marker size

Trang 15

I02 A Guide to Microsoft Excel 2002 for Scientists and Engineers

Figure 6.13

We noted earlier how the maximum value of the x-axis will depend

on the size you have made your chart Now we wish to fix the

maximum value

Figure 6.14

Trang 16

(a) This time we will go straight to the popup menu by right clicking on the x-axis Select Format Axis and open the Scale tab to get the dialog box - Figure 6.14

(b) Replace the value ( 5 or 6) in the Maximum box with 4 Note how the Auto box becomes unchecked

(c) Does the x-axis of your chart display the number 1,2,3, or

does it display 2, 4, etc.? If the latter is the case, change the

value in Major unit from 2 to 1 Click the OK button

It will resemble Figure 6.8 except that the box title will read simply Chart Options Make any changes you wish here and close the dialog box

(b) For the second method, select the chart title by clicking on it

A box with handles appears When the mouse pointer touches

the border, the point changes to an open arrow Now you can drag the title to a new location on the chart Note the slight inconsistency - normally when you are dragging an object the

mouse pointer turns into a four-headed arrow but in this case

it remains as a large open arrow

With the box still showing, start typing a new title (perhaps,

An Example of anXYChart) At first you may think nothing is

happening but look in the Formula box Press the formula bar's green check mark when you have completed the title

(c) We next try a modification of the second method Click on the

x-axis title to bring up the fill handles, then click inside their box and start typing Give the axis the title Speed km/hr Now repeat the process but use the title Speed km h-1 and then

select the last two characters Use the menu command Fy-matlSelected Axis Title to turn these characters into superscripts thus making the title Speed km h-'

Using what was learned in the last step, you should now be able to change the font for any one of the titles

Ngày đăng: 14/08/2014, 06:22