Sunteți pe pagina 1din 4

EXPERIMENT I

Introduction to MATLAB
I. Objectives
Students are able to explain basic operation and basic programming in
MATLAB and MATLAB application for Digital Signal Processing (DSP).

II. Scope

A. Brief Theory

MATLAB[5]
MATLAB stands for Matrix Laboratory. Its application usually at
these field:
Math and computation Algorithm development.
Data acquisition Modeling, simulation, and prototyping.
Data analysis, exploration, and visualization.
Scientific and engineering.
Graphics Application Development, including graphical user
interface building.
MATLAB application is broad enough especially for the fields which
need mathematical calculations help.
It is important to know that MATLAB works by matrix. All the
operation in MATLAB is matrix operation.
MATLAB can display the result as a graphic plot and can be designed
using our own GUI (Graphical User Interface) design.
By default, MATLAB components are consist of:

Figure 1.1 MATLAB Window

Command window is used to write function, command history is


used to review and reuse previous function while workspace is used to see
or create variable in MATLAB. Current directory show the working folder
the MATLAB working in.

Digital Signal Processing Guidance Computer Engineering Laboratory


Experiment I Page: 1 of 4
Some operation in MATLAB:
Addition, subtraction, multiplication, division, power of matrix
o Using the sign + - * / ^
Inverse and Transpose Matrix
o INV (matrix_name) to inverse
o TRANSPOSE (matrix_name) to transpose
Iteration
o Carried out by
X:Y => iteration fron X to Y with step 1
X:Y:Z => iteration from X to Z with step Y
Graphic Plot
o Plot (variable_name_to_be_plot)
o Subplot
Sometimes it also necessary to read MATLAB help.

DSP with MATLAB[5]


MATLAB can do some basic Digital Signal Processing operation such
as
Spectral Analysis
Filtering
Synthesis
Correlation
Control

MATLAB can also be used to do programming, for example using m-


file. M-file works the same as if we type the command directly at Command
Window, but we can type it first and run it later.
To start using m-file, go to File > New > m-file. There will be a new
Editor window shown.
Simulink is a part of MATLAB which is useful to analyze a model and
construction by simulation.

B. Devices

PC
MATLAB

III. References
1. Samuel D.Streans. (2002). Digital Signal Processing with Example in
Matlab. Edisi 1. CRC Press. New York. 978-0849310911.
2. Davis J Defatta ; Joseph G. Lucas ; William S.H. (1995). Digital Signal
Processing : A System Design Approach. John Wiley & Son.
3. Emannuel C Ifeachor. (1993). Digital Signal Processing : A Pratical
Approach. Addison-Wesley Publi.
4. John G Proakis ; Dimitris G.Manolakis. (1992). Digital Signal
Procesing, Principles, Algorithms, And Applications.2. Macmilian
Publishing. New York
5. About MATLAB: http://www.mathworks.com/
6. MatLab for DSP:
http://www.eng.auburn.edu/~sjreeves/Classes/DSP/DSP.html
Digital Signal Processing Guidance Computer Engineering Laboratory
Experiment I Page: 2 of 4
7. Matlab HELP
8. Richard G.Lyons. (2004). Understanding Digital Signal Processing.
Edisi 2. Prentice Hall. New Jersey. 978-031089891.

IV. Task Description and Procedure

A. MATLAB basic operation

a = [3 2 1 4 5 6]
b = [3 2 1;4 5 6]
pause
a = [12 3 4 5 6]
b = [1 2 3;4 5 6];
pause
c = a*b
pause
a = [2 2 2; 2 2 2; 2 2 2];
b = [7 8 9; 1 2 3; 4 5 6];
c = a*b
pause
d = a/b
pause
e = a.*b
pause
length(a)
c(1,2)
pause
n = 0:10
m = 0:2:10
pause
for i=-10:10
x(i+11) = 2*(i^2);
end
plot(x)

Digital Signal Processing Guidance Computer Engineering Laboratory


Experiment I Page: 3 of 4
B. Analog and Discrete Signal
1. Open new m-file (File > New > script), and type these program below
t = 0:0.005:2;
x = 2*cos(2*pi*t );
subplot(3,1,1), plot(t,x)
xlabel('Time (sec)')
ylabel('x(t)')
title('Analog Signal')
pause
n = 0:20;
x = 5*cos(2*pi*0.005*n);
subplot(3,1,2), stem(n,x)
xlabel('Time (sec)')
ylabel('x[n]')
title('Discrete Signal')
subplot(3,1,3)
xlabel('Time (sec)')
ylabel('Amplitude')
title('Sound Plot')
[y,Fs] = wavread(<tempat file suara di save>);
N = length(y);
Ts = 1/Fs ;
t = (0:N-1)*Ts
plot(t,y);

2. Save the result.

C. Frequency spectrum of a signal


1. Make a new m-file, type these program below:
close;
Fs = 10000;
Ts = 1/Fs;
t = 0:Ts:1;
y = 2*sin(2*pi*1000*t)+ ...
5*sin(2*pi*3500*t)+sin(2*pi*4000*t);
sound(y,Fs);
plot(t(1:100),y(1:100))
Y = fft(y,1024);
Ym = abs(Y);
f = Fs*(0:511)/1024;
figure;
plot(f,Ym(1:512));

2. Save the result.

V. Report Assignment
Use these points below in report
1. Explain the different between analog & digital signal.
2. Explanation about Digital Signal Processing
3. Disciplines covered as Digital Signal Processing.
4. Digital Signal Processing application in daily life.
5. Explanation about the use of MATLAB and commonly used syntax.
(give example to support your explanation)
6. Explain the result of this experiment.
7. Give 5 conclusions about this experiment.

Digital Signal Processing Guidance Computer Engineering Laboratory


Experiment I Page: 4 of 4

S-ar putea să vă placă și