Graphing a Cosine Wave with Google Sheets
Google Sheets can be used by students to graph cosine waves. A Cosine wave is a mathematical curve that describes a smooth repetitive oscillation. A cosine wave is identical to a sine wave, except that each point on the cosine wave occurs exactly 1/4 cycle earlier than the corresponding sine wave.
Click on the untitled spreadsheet name and rename it cosine wave.
We will create a list of degrees in our first column to set the initial values. We will then convert those values to radians. Angles need to be converted to radians because Google sheets uses radians in the cosine function. Click on cell A1 and type “x in degrees” for the heading. Press the enter key to go to the cell below or click on the cell below.
Enter a zero in cell A2 and press the enter key to go down to the next cell. Enter the values 30 and 60 respectively in the following cells using the same process.
We need to provide more values for our wave, but we don’t need to enter them ourselves. Google Sheets can help us create the remaining values. Highlight the first three values.
Click on the blue square that appears in the lower right corner of the selection. The mouse cursor will change to a plus sign when it can be selected. Click and drag the square box down the column.
Drag down to the 20th row and release.
Google Sheets will use the first three values as a pattern for creating the other values.
Click on cell B1 and type “x in radians” for the heading.
Google Sheets has a function that calculates the radian of a degree. Click on the cell below the heading we just typed and press the equal sign “=“ on the keyboard. An equal sign is used to tell Sheets we are about to perform a mathematical operation or use a function.
Type the word radians after the equal sign.
We need to either enter the value of the degree to convert to a radian or tell the function where the value can be found. In this example, the value for the radian function can be found in the adjacent column. The cell in the adjacent column is referred to as a reference cell. Reference cells are valuable because we can change the values in these cells and the value for the radians is automatically recalculated. If we didn’t use a reference cell then we would need to change each value in each radian function down the column.
To reference the adjacent cell, type an open parenthesis after the radians function. Sheets tries to help out by providing an example of what we can place after the open parenthesis.
Type the reference cell coordinates. In this example, that would be A2. The value A2 changes to an orange color. This is visual feedback for us so we know that Sheets sees the value as a reference to a cell.
Type a closing parenthesis to finish entering the value for the function. Press the return key to go down to the next cell in the column.
We could manually repeat this process for all the other cells, but we can use the same blue box we used earlier to generate the list of degrees. Select the cell where we just used the radians function. Click and drag the corner square down to row 20.
The radians function will use the values in the reference cells on the left calculate the radian for each degree.
Click on cell C1 and type “cosine” for the heading.
Sheets has a function that calculates the cosine using the radians value. Type and equal sign to begin the function and type cos after the equal sign.
Type an open parenthesis and provide the reference cell for the radians value. In this example, that would be B2.
Close the parenthesis and press the return key on your keyboard.
We can duplicate this function for the other values using the same process we used earlier. Click and drag the blue box down the column to row 20.
We have the values needed to create the wave graph. We need to select the values for degrees and the values for cosine. Click once on the column heading for degrees. This is the Sheet heading not the heading we entered in cell A1. Click on the “A”.
We need to select the values in the cosine column without selecting the radian values. We can use a shortcut key to bypass the column in the middle. Press and hold the control key on Windows or Chromebook. Hold the Command key on Mac. While holding one of these keys, click on column “C”. The two columns should be selected.
Click on the chart button in the button bar.
Click on the Chart Types tab in the Chart editor box that opens.
Click on the smooth line graph option.
Click on the option to use Column A as labels.
Click on the Customization tab.
Change the chart title to cosine wave.
Click on the legend option and select none.
Click on the Maximize option in the Feature section.
Click on the Point Shape option and select a shape option to identify each of the cosine values along the curve.
Click on the color option to select a different color for the point shapes and line.
Click on the Data labels value option if you want to display the value of each cosine point along the curve.
Click the insert button to place the graph onto the spreadsheet.
The graph might be placed above one of the columns of data. The graph can be moved by clicking and dragging the graph to the side.
The corner handles of the graph can be used to resize the graph.
To edit the chart, click on the pull down triangle in the top right hand corner of the graph. This triangle and the other tools appear when the chart is selected.
Changing the degrees value in column A will automatically update the radians and the values associated in the grah.