You are on page 1of 8

EEE Department

ECC311L DIGITAL SIGNAL PROCESSING LAB

Familiarization to MATLAB
TITLE

Submitted to:

Submitted by:

BSCpE - T091

January 30, 2016

Discussion

In this experiment, we familiarize ourselves with MATLAB and its capabilities


in helping us solve problems relating to Digital Signal Processing. MATLAB is short
for Matrix Laboratory which refers to the way it handles operations. MATLAB was
designed to solve matrices in mind. MATLAB was designed to be used in a widearray of application, but its main focus is in the Engineering and Sciences where it
stand out as a highly customizable Simulation Software because of its incredibly
detailed computation, visualization and complexity of available programming in an
easy to use interface.
We have learned the basic Arithmetic operations, as well as the fundamentals
of assigning Algebraic functions and variables. The experiment did not take us long
to finish but it was very meaningful and well thought out. We have learned how to
use the Command Window, where we type expressions to perform live, as well as
the Script Editor, where we program commands to be executed sequentially and
logically. Personally, I have found the Script Editor to be more familiar as I am a
Computer Engineering student and we are used to doing programming in an
environment similar to it. We have also explored how to read user inputs and how
output is being displayed in MATLAB. Matrices, Built-in functions, and how to use the
Help feature in MATLAB has been taught to us in this experiment.
I have not found any difficulty in executing the task given in the experiment.
Although, I have found it lacking in more complex examples. It would have been
great to have been given more exercises to execute as well as an introduction to a
generation of waveforms.

List of Commands
Code:
ftemp = input('Input number in Fahrenheit: ')
C = (ftemp-32)*5/9

In the first problem, we were asked to ask the user for input temperature in
Fahrenheit Scale and perform a conversion to Celsius scale. The problem is pretty
straightforward and the solution was pretty much laid out for the student. The
students were even given the formula that they will use to convert Fahrenheit to
Celsius. This problem introduced us to assigning values to variables, performing
arithmetic operations, and reading user inputs with prompts. This activity
introduced us the concept that MATLAB is a development environment that utilizes
Code:
A = [1 2 3]
B = [2 4 6]
a = transpose(A)
res = B*a
dot(A,B)

familiar schema to programming.


The second problem challenged us to utilize the matrix solving capabilities of
MATLAB and performing predefined operations available with the software. This
activity demonstrates the computing capability of the software in performing matrix
operations for which the software has been specifically designed for.

Syntax per Command


Code:
ftemp = input('Input number in Fahrenheit: ')
C = (ftemp-32)*5/9
ftemp
input(prom
pt)
C
=

A user-defined variable used to represent the users input for a


Fahrenheit Scale value.
A pre-defined function that requests user to input a value. In this
case, it prompts the user to input a value of a Fahrenheit
temperature they wish to convert to Celsius.
A user-defined variable used to represent the resulting Celsius scale
value.
This operator is used in assignment statements. It stores the
elements on the right side of the equations to the variable in the left
side of the equation.
This operator is used to perform subtraction. The value on the right
side of the equation is the minuend and the left side is the
subtrahend.
This operator is used to perform simple multiplication. The left side
of the Equation is the multiplicand and the right side is the
multiplier.
This operator is used to perform simple division. The left side of the
equation is the dividend and the right side of the equation is the
divisor.

Code:
A = [1 2 3]
B = [2 4 6]
a = transpose(A)
res = B*a
dot(A,B)

A
B
a
transpose(ma
trix)

A user-defined matrix that contains the Elements 1, 2, and 3.


A user-defined matrix that contains the Elements 2, 4, and 6.
A user-defined variable used to represent the transposed value of
Matrix A
A pre-defined function in MATLAB that returns the transpose of
the matrix enclosed. Transposition is where it interchanges the
row and the column index for each element in the matrix.

res
dot(A,B)

A user-defined variable used to represent the product of Matrix B


and the transpose of Matrix A.
A pre-defined function that returns the dot product of Matrices A
and B. It requires for the two vectors to have the same length. In
multi-dimensional arrays, the matrices must have the same size.

Results of the Experiment

Some of the commands and codes that were performed were pretty
straightforward and the ones that is slightly more difficult can be easily found in the
documentation of the Help page of MATLAB. The significance of this exercise is to
put into perspective the way we will be dealing with signals. That is, we will be
treating digital signals as if they are matrices where each values are elements in the
said matrix.
Digital Signal Processing maybe done manually, however as this experiment
tries to show the students is that there are pre-built functions that the students are
encouraged to use to make their activities and calculations easier. These are
commands that have been built into the software itself and is guaranteed to be
mathematically correct to some degree. We may use the included Help manual for
further definitions of these commands. The Help manual proved to be quite
effective as it is typically faster than accessing the internet for information on these
commands.
It was also implied that these commands are only helpful only if we know how
they functions and how the operations are dealt with the digital signals that we are
going to be processing. So the arithmetic and logic functions were also introduced
to us with some level of detail.

Conclusion

The experiment aimed to acquaint us with the functionalities and capabilities


of MATLAB as a software aide in doing mathematics and complex simulations. With
its pre-built functions, we could perform common operations as well as highly
complex ones with just a line of code. MATLAB was designed with scientist,
mathematicians, and engineers in mind, therefore its Simulations, visualizations,
and mathematical values needs to be correct in very precise degrees.
MATLAB is a highly customizable Simulation tool that we will be using for the
rest of the term, therefore familiarizing ourselves with it will benefit us in the future.
With functions ranging from simple Arithmetic and Logic operations, to complex
ones involving Matrices with numerous elements, MATLAB has proved to be an
indispensable tool for programmers, mathematicians, and engineers. However, no
matter how powerful the tool maybe, improper usage, and the lack of knowledge
will stunt its performance and will lead to poor results.

You might also like