Lab Report (01) Department of ECE
Lab Report (01) Department of ECE
Department of ECE
Student’s ID : 2018-2-50-029
Objective:
Gaining initial insight in MATLAB
Getting familiar with MATLAB’S user interface
Learning basic functions of MATLAB
Plotting trigonometrical graphs using MATLAB
Description: MathWorks created the MATLAB programming language. It began as a matrix programming
language with basic linear algebra programming. It is mainly used for computing and visualization.
MATLAB is an integrated framework with an array as its basic data feature that does not require
dimensioning. This helps us to solve many technical computing problems in a fraction of the time it takes to
write a program in other languages like C or Fortran, particularly those involving matrix and vector
formulations. From simple functions like number, sine, cosine, and complex arithmetic to more complex
functions like matrix inverse, matrix eigenvalues, Bessel functions, and fast Fourier transform, there is a
large array of computational algorithms. Therefore, MATLAB is a very popular tool among students and
university teachers.
Source code and Graphs:
Sin operation:
Sin graph:
Here we have taken the value of x from 0 to 2π, which means from 0 to 360°. Then we have to place the
variable x to a sin function. Our task is not finished here. To show the graphical representation we have to
use the plot() function. After that, to make the graph more perceivable I have added label on both x & y
axis.
Cosine operation:
Cosine graph:
Here, we can see a cosine wave. The implementation is similar to the previous sin wave. Only, instead of
sin() function a cos() function is used while everything else remains the same.
Tangent operation:
Tangent graph:
This figure here shows us the tangent wave between range 0 to 2 π. The tan() function is used to plot the
graph in MATLAB. The source code is the same as all the other functions only except the tan() function.
Secant operation:
Secant graph:
This figure here shows us the Secant wave between range 0 to 2 π. The sec() function is used to plot the
graph in MATLAB.
Cosecant operation:
Cosecant graph:
The tangent wave between ranges 0 and 2 π is depicted in this diagram. In MATLAB, the graph is plotted
using the csc() function. Except for the csc() module, the source code is the same as the previous functions.
Cotangent operation:
Cotangent graph:
This diagram depicts the tangent wave between ranges 0 and 2. The graph is plotted in MATLAB using the
cot() function. The source code is identical to the previous functions except for the cot() module.
Discussion:
In this lab, we have attained basic familiarities with MATLAB.
We have seen how to define variables, basic functions and write simple code.
Here we have plotted some trigonometrical functions and analyzed their graphs.
From the lab, we can see that plotting different trigonometrical functions are very easy and
the same source code can be used with the proper function to plot any graph.
We have also learned how to plot multiple graphs in a single window for side-by-side
analysis.