0% found this document useful (0 votes)
18 views

Signals and Systems

Uploaded by

606-M P FARDEEN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Signals and Systems

Uploaded by

606-M P FARDEEN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

SIGNALS AND SYSTEMS

SIMULATION ASSIGNMENT

NAME: M P FARDEEN
CLASS: EC-B [T4B]
ROLL NO: 612
INDEX:
 QUESTION
 SCILAB CODE
 SIMULATION RESULT
QUESTION:

1. Generate the following discrete signals


 Impulse Signal
 Pulse Signal
 Triangular Signal

2.
 Compute the linear convolution between the sequences
x = [ 1, 3, 5, 3] with h = [2, 3, 5, 6].
Observe the stem plot of both signals and the convolution.
 Now let h = [ 1, 2, 1] and x = [2, 3, 5, 6, 7]. Compute the
convolution between h and x.
 Flip the signal x by 180 so that it becomes [ 7, 6, 5, 3, 2].
Convolve it with h. Compare the result with the previous result.
 Repeat the above two steps with h = [1, 2, 3, 2, 1] and
h = [1, 2, 3, 4, 5, 4, 3, 2, 1]
 Give your inference.
SCILAB CODE AND SIMULATION
1. Impulse signal
clf;
clc;
clear all;
// Define the parameters
N = 10; // Number of samples
n = 5; // Time index of the impulse
// Generate the impulse signal
x = zeros(1, N);
x(n) = 1;
// Plot the impulse signal
plot2d3(x)
title('Impulse Signal');
xlabel('n');
ylabel('x[n]');

OUTPUT:
2. Pulse Signal
clf;
clc;
clear all;
// Define the parameters
N = 20; // Number of samples
n_start = 5; // Starting time index of the pulse
n_end = 15; // Ending time index of the pulse

// Generate the pulse signal


x = zeros(1, N);
x(n_start:n_end) = 1;

// Plot the pulse signal


plot2d3(x)
title('Pulse Signal');
xlabel('n');
ylabel('x[n]');

OUTPUT:
3. Triangular Signal
clf;
clc;
clear all;
// Define the parameters
N = 20; // Number of samples
n_mid = 10; // Middle point of the triangular signal

// Generate the triangular signal


x = [0:(n_mid-1), n_mid:(-1):1];

// Plot the triangular signal


plot2d3(x)
title('Triangular Signal');
xlabel('n');
ylabel('x[n]');

OUTPUT:
2.
 Compute the linear convolution between the sequences
x = [ 1, 3, 5, 3] with h = [2, 3, 5, 6].

clf;
clc;
clear all;
// Define the input sequences
x = [1,3,5,3];
h = [2,3,5,6];

// Compute the linear convolution


y = convol(x, h)

// Plot the stem plots


subplot(3, 1, 1);
plot2d3(x)
title('Signal x');
xlabel('n');
ylabel('x[n]');

subplot(3, 1, 2);
plot2d3(h)
title('Signal h');
xlabel('n');
ylabel('h[n]');

subplot(3, 1, 3);
plot2d3(y)
title('Convolution of x and h');
xlabel('n');
ylabel('y[n]');
OUTPUT:

 Now let h = [ 1, 2, 1] and x = [2, 3, 5, 6, 7]. Compute the


convolution between h and x.
clf;
clc;
clear all;
// Define the input sequences
h = [1,2,1];
x = [2,3,5,6,7];

// Compute the linear convolution


y = convol(x, h)

// Plot the stem plots


subplot(3, 1, 1);
plot2d3(x)
title('Signal x');
xlabel('n');
ylabel('x[n]');
subplot(3, 1, 2);
plot2d3(h)
title('Signal h');
xlabel('n');
ylabel('h[n]');

subplot(3, 1, 3);
plot2d3(y)
title('Convolution of h and x');
xlabel('n');
ylabel('y[n]');

OUTPUT:
 Flip the signal x by 180 so that it becomes [ 7, 6, 5, 3, 2].
Convolve it with h. Compare the result with the previous result
clf;
clc;
clear all;
// Define the input sequences
h = [1,2,1];
x = [2,3,5,6,7];

// Flip the signal x by 180 degrees


flipped=flipdim(x,2)

// Compute the linear convolution


y = convol(flipped, h)

// Plot the stem plots


subplot(2, 2, 1);
plot2d3(x)
title('Signal x');
xlabel('n');
ylabel('x[n]');

subplot(2, 2, 2);
plot2d3(flipped)
title('Signal x flipped');
xlabel('n');
ylabel('x[n]');

subplot(2, 2, 3);
plot2d3(h)
title('Signal h');
xlabel('n');
ylabel('h[n]');

subplot(2, 2, 4);
plot2d3(y)
title('Convolution of flipped x and h');
xlabel('n');
ylabel('y[n]');

OUTPUT:

 Repeat the above two steps with h = [1, 2, 3, 2, 1] and


h = [1, 2, 3, 4, 5, 4, 3, 2, 1]

clf;
clc;
clear all;
// Define the input sequences
h = [1, 2, 3, 2, 1];
x = [2, 3, 5, 6, 7];

// Compute the linear convolution


y = convol(x, h)

// Plot the stem plots


subplot(2, 2, 1);
plot2d3(x)
title('Signal x');
xlabel('n');
ylabel('x[n]');

subplot(2, 2, 2);
plot2d3(flipped)
title('Signal x flipped');
xlabel('n');
ylabel('x[n]');

subplot(2, 2, 3);
plot2d3(h)
title('Signal h');
xlabel('n');
ylabel('h[n]');

subplot(2, 2, 4);
plot2d3(y)
title('Convolution of flipped x and h');
xlabel('n');
ylabel('y[n]');

OUTPUT:

clf;
clc;
clear all;
// Define the input sequences
h = [1, 2, 3, 4, 5, 4, 3, 2, 1];
x = [2, 3, 5, 6, 7];

// Compute the linear convolution


y = convol(x, h)

// Plot the stem plots


subplot(2, 2, 1);
plot2d3(x)
title('Signal x');
xlabel('n');
ylabel('x[n]');

subplot(2, 2, 2);
plot2d3(flipped)
title('Signal x flipped');
xlabel('n');
ylabel('x[n]');

subplot(2, 2, 3);
plot2d3(h)
title('Signal h');
xlabel('n');
ylabel('h[n]');

subplot(2, 2, 4);
plot2d3(y)
title('Convolution of flipped x and h');
xlabel('n');
ylabel('y[n]');
OUTPUT:

Based on the convolutions performed using different values of h, here are the
inferences:

1. Convolution with h = [1, 2, 3, 2, 1]:


 The resulting convolution exhibits a symmetric shape.
 The output sequence is shorter than the input sequence due to the convolution
operation.
 The peak of the convolution occurs when the elements of x align with the
central elements of h.
2. Convolution with h = [1, 2, 3, 4, 5, 4, 3, 2, 1]:
 The resulting convolution exhibits a broader shape compared to the previous
case.
 The output sequence is longer than the input sequence due to the convolution
operation.
 The peak of the convolution occurs when the elements of x align with the
central elements of h, resulting in a more spread-out response.
In both cases, the convolution operation combines the characteristics of the
input signal x and the impulse response h. The shape and characteristics of the
resulting convolution are influenced by the values and length of the impulse
response

You might also like