Chapter 2

                                                             
******************************************************************************
                                                    CHAPTER 2

                                Generating and Plotting  Trigonometric
                                     exponential function
******************************************************************************

Excel can be used for generating and plotting important trigonometric functions. The experienced gained through  this chapter will be used for exploring many concepts in Calculus. In calculus , the unit of measurement for plane angle is radian but for everyday use we use degree as the unit . In excel all trigonometric ratios assume the unit of its argument is in  radians.  So excel provide a function radians( ) to convert degrees into radians. 


Experiment 1: Computing sine for a set  of angles given in degrees 

Step 1 :  In cell A2 type 0.  In cell A3 type 10. Select these two cells and drag the fill handle  till A7.
Step 2:  In cell B2 type  =Radians(A2)  and in Cell C2 type  = sin(B2)
Step 3 :  Select cell B2 and C2 and drag down the fill handle till C7

Figure 2.1 and 2.2 shows the output 
  
 
                                             Figure 2.1                                          Figure 2.2

Note the following. 

1.      Excel has some built in intelligence. In two consecutive cells, if you type in  1 and 2 and after selecting these two cells, when you drag , the output sequence will be 1,2,3,4,5 etc. Here, excel calculate the difference in the contents of two selected cells and as in an arithemetic progression  fills the subsequent cells.
2.      Same thing happens for days of the week also. Type ‘sun’  in any one cell and ‘mon’  in the next cell and then drag the fill handle after selecting these two cells. See that the excel fills remaining days of the week 

Experiment No:2  Function of function
 
Let us modify the experiment No: 1 . Let us try to combine the conversion of angles in degrees to radians and the computation of sine into a single step. 

Step 1 :  In cell A2 type 0.  In cell A3 type 10. Select these two cells and drag the fill handle  till A7.
Step 2:  In cell B2 type  =sin(Radians(A2))  
Step 3 :  Select  cell B2 and drag down the fill handle till B7

Figure 2.3 and 2.4 shows the output 

                                          Figure 2.3                                        Figure 2.4 

Experiment No:3   Drawing a full -period sine and cosine wave 

Here we take angle from 0 to 360 degree and plot using excel’s Plotting tool
Step 1 :  In cell A2 type 0.  In cell A3 type 1. Select these two cells and drag the fill handle  till A361.
Step 2:  In cell B2 type  =sin(Radians(A2)) 
            and in Cell C2 type  = cos(Radians(A2))
Step 3 :  Select  cells B2 and C2 and drag down the fill handle till C361
Step 4. Click on ‘insert’ menu bar and then click on ‘scatter’ and choose continuous curve options available in the menu. Screen shots describing these options are shown in figure below 


                                                                       Figure 2.5
                                                            Figure 2.6                               Figure 2.7
                                                                       Figure 2.8

Can we draw full sine and cosine wave without a separate column for angle. This requires a function which can generate the integer sequence  0, 1 ,2,3 …  as we pull down a formula. Also we should be able to generate such sequence vertically as well as horizontally. Excel provide two functions for this task. These are row( ) and column( )  function. 

Row and column functions

This is a very useful function and in due course we will encounter many applications for this function. The formula =Row(A1) returns row-number of the cell A1. Since  cell A1 is in first row, it returns 1. Note that row function has nothing to do with the content of the referenced cell. The formula =Row(F1) also returns 1 as cell F1 is in the first row. Now if pull down the formula =Row(A1)  by one cell, A1 become A2 and function row(A2 )  returns 2. So by pulling down this formula we can generate the sequence 1,2,3… . Similarly column function returns column number of the referenced cell. For example, =column(D3) returns 4 since cell D3 is in fourth column. This function can be used to generate integer sequence in consecutive horizontal cells. 

Experiment No:4   Generate a full-period sine wave without using separate column for angles.

             Step1:  In cell A1 type =sin(radians(row(c1)-1))
                       Note:  row(c1)-1 returns 0. We could have also written row(a1)-1
             Step 2 Select cell A1 and drag the formula till cell A361
             Step 3: Select column A by clicking on the column head and go for scatter 
                         plot as in previous example.


                                              Figure 2.9                                     Figure 2.10

Experiment No:5   

 Generate a full-period cosine wave without using separate column for angles and without using ‘radians’ function.
We can directly generate angle in radians from 0 to 2pi  using ‘row( )’ function . For convenience we generate angles in 0.1 radians apart. This is achieved by using a formula with row function as     = (row(c1)-1)*(0.1)
Here are the required steps to generate full–period cosine function
Step1: In cell A1 type =cos((row(c1)-1)*(0.1))
    Note: row(c1)-1 returns 0. We could have also written row(a1)-1
Step 2 Select cell A1 and drag the formula till cell A63
Step 3: Select column A by clicking on the column head and go for scatter plot as in previous example.



 
                                              Figure 2.11                               Figure 2.12






 
                2D Sinc Function can be plotted.



                [X,Y] = meshgrid(-8:.5:8);

                R = sqrt(X.^2 + Y.^2) + eps;

                Z = sin(R)./R;

                mesh(X,Y,Z,'EdgeColor','black')



                DFT Matrix



                DCT Matrix 




 

 







 




No comments:

Post a Comment