Experiment 5
Experiment 5
Theory:
clc;
clear all;
close all;
% Define the continuous-time signals (discretized form)
t1 = -5:0.1:5; % Time vector for x(t)
t2 = -5:0.1:5; % Time vector for h(t)
% Example signals: x(t) and h(t)
x_t = (t1 >= 0 & t1 <= 1); % Rectangular pulse signal
h_t = exp(-t2) .* (t2 >= 0); % Exponential signal
% Plot the input signals
figure;
subplot(3,1,1);
plot(t1, x_t, 'LineWidth', 1.5);
xlabel('Time (t)'); ylabel('x(t)');
title('Signal x(t)');
grid on;
subplot(3,1,2);
plot(t2, h_t, 'LineWidth', 1.5);
xlabel('Time (t)'); ylabel('h(t)');
title('Signal h(t)');
grid on;
% Perform convolution using conv()
dt = 0.1; % Sampling interval
y_t = conv(x_t, h_t) * dt; % Convolution scaled by dt
% Time vector for convolution result
t_conv = (t1(1) + t2(1)):dt:(t1(end) + t2(end));
% Plot the output signal
subplot(3,1,3);
plot(t_conv, y_t, 'LineWidth', 1.5);
xlabel('Time (t)');
ylabel('y(t)');
title('Convolution Output y(t) = x(t) * h(t)');
grid on;
Output:
Result: Linear Convolution of continuous-time signals in MATLAB is implemented and
verified the results mathematically.