Signals and Systems
Signals and Systems
SIMULATION ASSIGNMENT
NAME: M P FARDEEN
CLASS: EC-B [T4B]
ROLL NO: 612
INDEX:
QUESTION
SCILAB CODE
SIMULATION RESULT
QUESTION:
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
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
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];
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:
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];
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:
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];
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: