Department: Mechatronics

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Ministry of Higher Education and Scientific Research

Middle Technical University

Engineering Technical College – Baghdad

Department : Mechatronics

Stage : fourth

Name of Experiment : Generation of Discrete signal

Name: Sajad Habeb abaas

Date : 20/6/2020
Basic Definitions

A discrete-time signal is a complex-valued sequence. Remember that


a sequence is defined as a complex-valued function of an integer
index n, with n Z; as such, it is a two-sided, infinite collection of
values. A sequence can be defined analytically in closed form, as for
example:

(2.1)

shown as the “triangular” waveform plotted in Figure 2.1; or

(2.2)

which is a complex exponential of period 40 samples, plotted in


Figure 2.2. An example of a sequence drawn from the real world is

(2.3)

plotted in Figure 2.3 from year 1900 to 2002. Another example, this
time of a random sequence, is

(2.4)

a realization of which is plotted in Figure 2.4.

Fig2.1
Fig2.2

Fig2.3

Fig2.4
Aim:

To write a "MATLAB" program to generate discrete time signals


like unit impulse, unit step, unit ramp. Exponential signal sinusoidal
sequences.

The code:

1.Unit impulse signal:


clc;
clear all;
close all;
n=-10:10;
for i=1:21
if n(i)==0
x(i)=1;
else
x(i)=0;
end
end
stem(n,x)
2.Unit step signal:
clc;
clear all;
close all;
n=-10:10;
for i=1:21
if n(i)>=0
x(i)=1;
else
x(i)=0;
end
end
stem(n,x)
3.Unit ramp signal:
clc;
clear all;
close all;
n=-10:10;
for i=1:21
if n(i)>=0
x(i)=n(i);
else
x(i)=0;
end
end
stem(n,x)

4.exponential signal:
clc;
clear all;
close all;
n=-10:10;
for i=1:21;
x(i)=0.85^n(i);
end
stem(n,x)

5.sinusoidal signal:
clc;
clear all;
close all;
n=-10:10;
for i=1:21;
x(i)=sin(2*pi*0.1*n(i));
end
stem(n,x)
Question:
1.A delayed unit sample sequence with a delay of (11) samples?
n=-5:15;
L=length(n);
for i=1:L
if n(i)==11
x(i)=1;
else
x(i)=0;
end
end
stem(n,x)
2.A sinusoidal sequence of freq. (0.9 , 1.5 , 3)?

n=-10:10
x=sin(2*pi*0.9*n)
stem(n,x)

n=-10:10
x=sin(2*pi*1.5*n)
stem(n,x)
n=-10:10
x=sin(2*pi*3*n)
stem(n,x)

You might also like