SS LAB Manual
SS LAB Manual
2025
12
2304205-Signals & Systems Lab
Programme B. Tech - ECE Sem Category L T P Credits
& Branch
Professional
Prerequisites Nil 4 0 0 3 1.5
Core
Preamble In this Lab, the student will acquire hands-on experience with programming in
MATLAB. MATLAB programming will enable them to provide real-time
scenario to understand the theory behind signals and systems as well as validate
the theory with real-word examples.
List of Experiments:
1 Write a program to plot the following continuous time and discrete time signals.
i. Step Function
ii. Impulse Function
iii. Exponential Function
iv. Ramp Function
v. Sine Function
2 Write a program to perform arithmetic operations: addition, subtraction and multiplication
on continuous-time signals.
3 Write a program to perform amplitude-scaling, time-scaling and time shifting on a given
signal.
4 Write a program to find Energy and Power of a given signal.
5 Write a program to find the trigonometric and exponential Fourier series coefficients of a
periodic signal.
6 Write to find Fourier Transform of a given signal and plot its Magnitude and Phase
Spectrum.
7 Write a program
i) To find the Laplace Transform of a given signal.
ii) To find the inverse Laplace Transform of a given transfer function.
8 Write a program to compute and plot the impulse response and pole-zero diagram of
transfer function using Laplace transform.
9 Write a program to compute the linear convolution of continuous-time signals.
CO 3 2 1 1 2 - - - 1 - - - 3 3
3
3
CO 4 3 1 1 2 - - - 1 - - - 3 3
CO 5 3 1 1 2 - - - 1 - - - 3 3
3
1 – Slight, 2 – Moderate, 3 – Substantial
Department of Electronics & Communications Engineering SS LAB
EXPERIMENT-01
GENERATION OF STANDARD SIGNALS
AIM: Write a program to plot the following continuous time and discrete time signals.
i. Step Function
v. Sine Function
APPARATUS REQUIRED:
SOFTWARE: MATLAB
PROCEDURE:
1. Start the MATLAB program.
2. Open new M-file
3. Type the program
4. Save in current directory
5. Compile and Run the program
6. If any error occurs in the program correct the error and run it again
7. For the output see command window\ Figure window
8. Stop the program.
Signals and Systems Lab, Dept of ECE, Raghu Engineering College, Visakhapatnam Page1
Department of Electronics & Communications Engineering SS LAB
% Step Function
u_t = (T >= 0);
figure;
plot(T, u_t, 'LineWidth', 2);
title('Continuous Step Function');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Impulse Function
impulse_t = (T == 0);
figure;
plot(T, impulse_t, 'LineWidth', 2);
title('Continuous Impulse Function (Ideal)');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Exponential Function
a = 0.5;
exp_t = exp(a*T);
figure;
plot(T, exp_t, 'LineWidth', 2);
title('Continuous Exponential Function');
xlabel('Time');
ylabel('Amplitude');
grid on;
Signals and Systems Lab, Dept of ECE, Raghu Engineering College, Visakhapatnam Page2
Department of Electronics & Communications Engineering SS LAB
% Ramp Function
ramp_t = T .* (T >= 0);
figure;
plot(T, ramp_t, 'LineWidth', 2);
title('Continuous Ramp Function');
xlabel('Time');
ylabel('Amplitude');
grid on;
% Sine Function
f = 1; % Frequency in Hz
sine_t = sin(2*pi*f*T);
figure;
plot(T, sine_t, 'LineWidth', 2);
title('Continuous Sine Function');
xlabel('Time');
ylabel('Amplitude');
grid on;
Signals and Systems Lab, Dept of ECE, Raghu Engineering College, Visakhapatnam Page3
Department of Electronics & Communications Engineering SS LAB
OUTPUT :
Signals and Systems Lab, Dept of ECE, Raghu Engineering College, Visakhapatnam Page4
Department of Electronics & Communications Engineering SS LAB
Signals and Systems Lab, Dept of ECE, Raghu Engineering College, Visakhapatnam Page5
Department of Electronics & Communications Engineering SS LAB
Signals and Systems Lab, Dept of ECE, Raghu Engineering College, Visakhapatnam Page6
Department of Electronics & Communications Engineering SS LAB
% Ramp Function
ramp_n = n .* (n >= 0);
figure;
stem(n, ramp_n, 'filled');
title('Discrete Ramp Function');
xlabel('n');
ylabel('Amplitude'); grid on;
% Sine Function
f = 1; % Frequency in Hz
sine_n = sin(0.2*pi*f*n);
figure;
stem(n, sine_n, 'filled');
title('Discrete Sine Function');
xlabel('n');
ylabel('Amplitude');
grid on;
OUTPUT :
Signals and Systems Lab, Dept of ECE, Raghu Engineering College, Visakhapatnam Page7
Department of Electronics & Communications Engineering SS LAB
Signals and Systems Lab, Dept of ECE, Raghu Engineering College, Visakhapatnam Page8
Department of Electronics & Communications Engineering SS LAB
RESULT:
Signals and Systems Lab, Dept of ECE, Raghu Engineering College, Visakhapatnam Page9
Department of Electronics & Communications Engineering SS LAB
EXPERIMENT – 02
BASIC SIGNAL OPERATIONS: Addition, Subtraction and Multiplication
AIM: Write a program to perform arithmetic operations: addition, subtraction and multiplication
on continuous-time signals.
APPARATUS REQUIRED:
MATLAB program:
clc;
clear;
close all;
% Define time range
t = -5:0.01:5; % Continuous-time representation
% Define two continuous-time signals
x1 = sin(2*pi*0.5*t); % First signal (Sine wave)
x2 = cos(2*pi*0.5*t); % Second signal (Cosine wave)
% Perform Arithmetic Operations
add_signal = x1 + x2; % Addition of signals
sub_signal = x1 - x2; % Subtraction of signals
mul_signal = x1 .* x2; % Multiplication of signals (Point-wise multiplication)
% Plot Results
figure;
subplot(5,1,1);
plot(t, x1, 'b', 'LineWidth', 1.5);
title('Signal x_1(t) = sin(2\pi 0.5t)');
xlabel('Time (t)');
ylabel('Amplitude');
grid on;
subplot(5,1,2);
plot(t, x2, 'r', 'LineWidth', 1.5);
title('Signal x_2(t) = cos(2\pi 0.5t)');
xlabel('Time (t)');
ylabel('Amplitude');
grid on;
subplot(5,1,3);
plot(t, add_signal, 'g', 'LineWidth', 1.5);
RESULT:
EXPERIMENT – 03
AIM: Write a program to perform amplitude-scaling, time-scaling and time shifting on a given signal.
APPARATUS REQUIRED:
MATLAB code:
clc;
clear;
close all;
% Define time range
t = -5:0.01:5; % Continuous-time approximation
% Define original signal (Example: Sinusoidal Signal)
x = sin(2*pi*0.5*t);
% Transformation parameters
A = 2; % Amplitude scaling factor
alpha = 0.5; % Time scaling factor
tau = 2; % Time shift value
% Perform Transformations
x_amplitude_scaled = A * x; % Amplitude Scaling
x_time_scaled = sin(2*pi*0.5*(alpha*t)); % Time Scaling
x_time_shifted = sin(2*pi*0.5*(t - tau)); % Time Shifting
% Plot Original and Transformed Signals
figure;
subplot(4,1,1);
plot(t, x, 'b', 'LineWidth', 1.5);
title('Original Signal: x(t) = sin(2\pi 0.5t)');
xlabel('Time (t)');
ylabel('Amplitude');
grid on;
subplot(4,1,2);
plot(t, x_amplitude_scaled, 'r', 'LineWidth', 1.5);
title('Amplitude Scaled Signal');
xlabel('Time (t)');
ylabel('Amplitude');
grid on;
subplot(4,1,3);
plot(t, x_time_scaled, 'g', 'LineWidth', 1.5);
title('Time Scaled Signal');
xlabel('Time (t)');
ylabel('Amplitude');
grid on;
subplot(4,1,4);
plot(t, x_time_shifted, 'm', 'LineWidth', 1.5);
title('Time Shifted Signal');
xlabel('Time (t)');
ylabel('Amplitude');
grid on;
OUTPUT:
RESULT:
EXPERIMENT-04
FINDING ENERGY AND POWER OF A GIVEN SIGNAL.
APPARATUS REQUIRED:
MATLAB CODE:
EXPERIMENT-05
MATLAB CODE:
clc;
clear;
close all;
% Define the period and fundamental frequency
T = 2*pi;
w0 = 2*pi/T;
% Define the periodic function (Example: x(t) = cos(t) + 0.5*sin(2*t))
x_t = @(t) cos(t) + 0.5*sin(2*t);
% Number of Fourier coefficients to compute
N = 5;
% Compute Fourier Coefficients
a0 = (1/T) * integral(@(t) x_t(t), -T/2, T/2); % DC Component
for n = 1:N
an(n) = (2/T) * integral(@(t) x_t(t).*cos(n*w0*t), -T/2, T/2);
Dept of ECE, Raghu Engineering College, Visakhapatnam
Page18
Department of Electronics & Communications Engineering SS LAB
for n = -N:N
fprintf('n = %d: c_n = %.4f + %.4fi\n', n, real(c_n(n+N+1)), imag(c_n(n+N+1)));
end
OUTPUT:
Exponential Fourier Series Coefficients (c_n):
n = -5: c_n = -0.0000 + -0.0000i
n = -4: c_n = 0.0000 + 0.0000i
n = -3: c_n = -0.0000 + -0.0000i
n = -2: c_n = 0.0000 + 0.2500i
n = -1: c_n = 0.5000 + 0.0000i
n = 0: c_n = 0.0000 + 0.0000i
n = 1: c_n = 0.5000 + -0.0000i
n = 2: c_n = 0.0000 + -0.2500i
n = 3: c_n = -0.0000 + 0.0000i
n = 4: c_n = 0.0000 + -0.0000i
n = 5: c_n = -0.0000 + 0.0000i
RESULT:
EXPERIMENT-06
FOURIER TRANSFORM
AIM: Write to find Fourier Transform of a given signal and plot its Magnitude and Phase
Spectrum.
APPARATUS REQUIRED:
MATLAB CODE:
clc;
clear;
close all;
% Define the signal
t = 0:0.1:2*pi; % Time vector
x = sin(2*pi*1*t) + 0.5*sin(2*pi*2*t); % Example signal (sum of two sinusoids)
% Compute Fourier Transform
X = fft(x);
% Compute Magnitude and Phase spectra
magnitude = abs(X);
phase = angle(X);
% Compute Inverse Fourier Transform
x_reconstructed = ifft(X);
% Plot original signal
subplot(2, 2, 1);
plot(t, x);
title('Original Signal');
xlabel('Time');
ylabel('Amplitude');
% Plot Magnitude Spectrum
subplot(2, 2, 2);
stem(magnitude);
title('Magnitude Spectrum');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
% Plot Phase Spectrum
subplot(2, 2, 3);
stem(phase);
title('Phase Spectrum');
xlabel('Frequency (Hz)');
ylabel('Phase (radians)');
OUTPUT:
RESULT:
EXPERIMENT-07
LAPLACE TRANSFORM
APPARATUS REQUIRED:
PROCEDURE:
i) MATLAB CODE:
OUTPUT:
RESULT:
EXPERIMENT-08
POLE-ZERO DIAGRAM
AIM: Write a program to compute the impulse response and plot the pole-zero diagram of
transfer function using Laplace transform.
APPARATUS REQUIRED:
PROCEDURE:
MATLAB CODE:
OUTPUT:
RESULT:
EXPERIMENT-09
LINEAR CONVOLUTION
APPARATUS REQUIRED:
PROCEDURE:
MATLAB CODE:
clc;
clear;
close all;
% Time range and step (simulation of continuous time)
t1 = 0:0.01:5; % time for signal x(t)
t2 = 0:0.01:5; % time for signal h(t)
% Define two continuous-time signals (example signals)
x = exp(-t1); % x(t) = e^(-t)
h = sin(t2); % h(t) = sin(t)
% Compute linear convolution
y = conv(x, h) * 0.01; % Multiply by time step (dt) for continuous-time approximation
% Generate time vector for the convolved signal
t_conv = (0:(length(y)-1)) * 0.01;
% Plot the input signals and their convolution
figure;
subplot(3,1,1);
plot(t1, x, 'b', 'LineWidth', 2);
title('Signal x(t) = e^{-t}');
xlabel('Time (t)');
ylabel('x(t)');
grid on;
subplot(3,1,2);
plot(t2, h, 'r', 'LineWidth', 2);
title('Signal h(t) = sin(t)');
xlabel('Time (t)');
ylabel('h(t)');
grid on;
subplot(3,1,3);
plot(t_conv, y, 'k', 'LineWidth', 2);
title('Linear Convolution y(t) = x(t) * h(t)');
xlabel('Time (t)');
ylabel('y(t)');
grid on;
OUTPUT:
RESULT:
EXPERIMENT-10
AUTO CORRELATION
AIM: Write a program to compute auto correlation between two continuous-time signals.
APPARATUS REQUIRED:
PROCEDURE:
MATLAB CODE:
% MATLAB Program to compute and plot autocorrelation of a signal
% Define time axis (discrete approximation)
t = 0:0.01:10; % Time vector from 0 to 10 with a step of 0.01 seconds
% Define the signal (e.g., sine wave)
signal = sin(2*pi*1*t); % Signal: Sine wave with frequency 1 Hz
% Compute the autocorrelation of the signal
auto_corr = xcorr(signal, 'coeff'); % Autocorrelation using xcorr
% Time axis for autocorrelation plot
t_corr = -t(end):0.01:t(end);
% Plot the original signal
figure;
subplot(2,1,1);
plot(t, signal);
title('Original Signal: Sine Wave');
xlabel('Time (s)');
ylabel('Amplitude');
% Plot the autocorrelation of the signal
subplot(2,1,2);
plot(t_corr, auto_corr);
title('Autocorrelation of Signal');
xlabel('Lag');
ylabel('Autocorrelation');
grid on;
OUTPUT:
RESULT:
EXPERIMENT-11
CROSS CORRELATION
AIM: Write a program to compute Cross correlation between two continuous-time signals.
APPARATUS REQUIRED:
PROCEDURE:
MATLAB CODE:
% MATLAB Program to compute and plot cross-correlation between two signals
% Define time axis (discrete approximation)
t = 0:0.01:10; % Time vector from 0 to 10 with a step of 0.01 seconds
% Define two signals (e.g., sine and cosine waves)
signal1 = sin(2*pi*1*t); % Signal 1: Sine wave with frequency 1 Hz
signal2 = cos(2*pi*1*t); % Signal 2: Cosine wave with frequency 1 Hz
% Compute the cross-correlation between signal1 and signal2
cross_corr = xcorr(signal1, signal2, 'coeff'); % Cross-correlation
% Time axis for cross-correlation plot
t_corr = -t(end):0.01:t(end);
% Plot the signals
figure;
subplot(3,1,1);
plot(t, signal1);
title('Signal 1: Sine Wave');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3,1,2);
plot(t, signal2);
title('Signal 2: Cosine Wave');
xlabel('Time (s)');
ylabel('Amplitude');
% Plot the cross-correlation
subplot(3,1,3);
plot(t_corr, cross_corr);
title('Cross-Correlation between Signal 1 and Signal 2');
xlabel('Lag');
ylabel('Cross-Correlation');
grid on;
OUTPUT:
RESULT:
EXPERIMENT-12
SAMPLING THEOREM
APPARATUS REQUIRED:
PROCEDURE:
MATLAB CODE:
% MATLAB Program to verify Sampling Theorem
% Define time vector for the continuous signal (high resolution)
t_cont = 0:0.001:1; % Continuous time vector from 0 to 1 second with step size 0.001 seconds
% Define frequency of the continuous-time signal
f = 10; % Frequency of the signal in Hz (less than the Nyquist frequency)
% Define the continuous signal (sine wave)
x_cont = sin(2*pi*f*t_cont);
% Sampling rates
fs1 = 20; % Sampling rate 1 (Below Nyquist rate)
fs2 = 30; % Sampling rate 2 (Above Nyquist rate)
fs3 = 50; % Sampling rate 3 (Well above Nyquist rate)
% Time vectors for sampled signals (discrete signals)
t1 = 0:1/fs1:1; % Time vector for sampling rate fs1
t2 = 0:1/fs2:1; % Time vector for sampling rate fs2
t3 = 0:1/fs3:1; % Time vector for sampling rate fs3
% Sample the continuous signal at the defined rates
x1 = sin(2*pi*f*t1); % Sampled signal at fs1
x2 = sin(2*pi*f*t2); % Sampled signal at fs2
x3 = sin(2*pi*f*t3); % Sampled signal at fs3
% Reconstruct the sampled signals using interpolation (zero-order hold)
x1_reconstructed = sin(2*pi*f*t_cont); % Reconstructed signal for fs1 (same frequency, no aliasing)
x2_reconstructed = sin(2*pi*f*t_cont); % Reconstructed signal for fs2 (same frequency, no aliasing)
x3_reconstructed = sin(2*pi*f*t_cont); % Reconstructed signal for fs3 (same frequency, no aliasing)
% Plot the results
figure;
% Plot continuous-time signal
subplot(4,1,1);
plot(t_cont, x_cont, 'LineWidth', 1.5);
title('Original Continuous-Time Signal');
xlabel('Time (s)');
ylabel('Amplitude');
% Plot sampled signal at fs1 (Below Nyquist rate)
subplot(4,1,2);
stem(t1, x1, 'r', 'LineWidth', 1.5);
Dept of ECE, Raghu Engineering College, Visakhapatnam
Page39
Department of Electronics & Communications Engineering SS LAB
hold on;
plot(t_cont, x_cont, 'b', 'LineWidth', 1); % Plot continuous signal for comparison
title(['Sampled Signal at fs1 = ' num2str(fs1) ' Hz (Below Nyquist)']);
xlabel('Time (s)');
ylabel('Amplitude');
legend('Sampled Signal', 'Continuous Signal');
% Plot sampled signal at fs2 (Above Nyquist rate)
subplot(4,1,3);
stem(t2, x2, 'g', 'LineWidth', 1.5);
hold on;
plot(t_cont, x_cont, 'b', 'LineWidth', 1); % Plot continuous signal for comparison
title(['Sampled Signal at fs2 = ' num2str(fs2) ' Hz (Above Nyquist)']);
xlabel('Time (s)');
ylabel('Amplitude');
legend('Sampled Signal', 'Continuous Signal');
% Plot sampled signal at fs3 (Well above Nyquist rate)
subplot(4,1,4);
stem(t3, x3, 'm', 'LineWidth', 1.5);
hold on;
plot(t_cont, x_cont, 'b', 'LineWidth', 1); % Plot continuous signal for comparison
title(['Sampled Signal at fs3 = ' num2str(fs3) ' Hz (Well Above Nyquist)']);
xlabel('Time (s)');
ylabel('Amplitude');
legend('Sampled Signal', 'Continuous Signal');
OUTPUT:
RESULT: