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

Register Number: Expt. No.

:
Name: Date:
Slot: L49+50

GENERATION OF SIGNALS

AIM:

To generate the following signals using MATLAB R2017b.

1. Unit impulse signal


2. Unit step signal
3. Unit ramp signal
4. Exponentially increasing signal
5. Exponentially decreasing signal
6. Sine signal
7. Triangular signal
8. Gaussian signal
9. Parabolic signal

APPARATUS REQUIRED:

System with MATLAB R2017b.

MATLAB PROGRAM:

1. UNIT IMPULSE SIGNAL


clc;
clear all;
close all;
% Generate a vector from -10 to 20
n = -10:20;
% Generate the unit sample sequence
u = [zeros(1,10) 1 zeros(1,20)];
% Plot the unit sample sequence
stem(n,u);
xlabel('Time index n');
ylabel('Amplitude');
title('Unit Sample Sequence');
axis([-10 20 0 1.2]);

EEE2005-DSP Lab L49+50 Class Number: VL2018195001619 Winter 2018-19


2. UNIT STEP SIGNAL

n=-20:20;
u=[zeros(1,20),1,ones(1,20)];
stem(n,u);

3. RAMP SIGNAL

n=-10:10;
z=[zeros(1,11),1:10];
axis([-10 10 0 11]);
title('ramp');

4. EXPONENTIALLY INCREASING SIGNAL

n=0:10;
a=2;
x=a.^n;
stem(n,x);

5. EXPONENTIALLY DECREASING SIGNAL

n=0:10;
a=0.5;
x=a.^n;
stem(n,x);

6. SINUSOIDAL SIGNAL

t=0:0.1:20;
x=3*sin(t);
7. TRIANGULAR SIGNAL

a=2;
x1=1-abs(t)/a;
x2=0;
x=x1.*(abs(t)<=a)+ x2.*(abs(t)>a);

EEE2005-DSP Lab L49+50 Class Number: VL2018195001619 Winter 2018-19


8. GAUSSIAN SIGNAL

a=2;
x=exp(-a.*(t.^2));

9. PARABOLIC SIGNAL

a=0.4;
x1=(a*(t.^2))/2;
x2=0;
x=x1.*(t>=0)+ x2.*(t<0);

RESULT:

INFERENCE:

REFERENCES:

OUTPUT:

EEE2005-DSP Lab L49+50 Class Number: VL2018195001619 Winter 2018-19


Register Number: Expt. No.:
Name: Date:
Slot: L49+50

CONVOLUTION OF SIGNALS

AIM:

To write a program for performing linear and circular convolutions of two signals using
MATLAB R2017b.

APPARATUS REQUIRED:

System with MATLAB R2017b.

LINEAR CONVOLUTION:

EEE2005-DSP Lab L49+50 Class Number: VL2018195001619 Winter 2018-19


ALGORITHM:

1. Get the number of samples.

2. Generate the output sequence of the given two input signals.

3. Plot the graph.

MATLAB PROGRAM:

LINEAR CONVOLUTION

clc;
clear all;
close all;
x=input('samples of x(n)');
h=input('samples of h(n)');
xlen= length(x);
hlen=length(h);
k=0;
for i=1:xlen;
for j=1:hlen;
y(i,j+k) = x(i)*h(j);
end
k=k+1;
end;
disp('conv');
z=sum(y);
stem(z);

RESULT:

INFERENCE:

REFERENCES:

OUTPUT:

EEE2005-DSP Lab L49+50 Class Number: VL2018195001619 Winter 2018-19


Register Number: Expt. No.:
Name: Date:
Slot: L49+50

CORRELATION OF SIGNALS

AIM:

To write a program for performing correlation of two signals using MATLAB R2017b.

APPARATUS REQUIRED:

System with MATLAB R2017b.

AUTO-CORRELATION:

CROSS-CORRELATION:

EEE2005-DSP Lab L49+50 Class Number: VL2018195001619 Winter 2018-19


ALGORITHM:

1. Get the number of samples.

2. Generate the output sequence of the given two input signals using ‘corr’ command.

3. Plot the graph.

MATLAB PROGRAM:

CROSS CORRELATION:

clc;
clear all;
x=input('enter samples of x');
h=input('enter samples of h');
xlen=length(x);
hlen=length(h);
for i=1:xlen;
for j=1:xlen;
y(i,i+j-1)=x(i)*h(hlen-j+1);
end
end
z=sum(y);
disp('output');z
disp('output sequence');y
stem(x,y);

AUTO CORRELATION:

EEE2005-DSP Lab L49+50 Class Number: VL2018195001619 Winter 2018-19


RESULT:

INFERENCE:

REFERENCES:

OUTPUT:

EEE2005-DSP Lab L49+50 Class Number: VL2018195001619 Winter 2018-19

You might also like