Krishnanshu belwanshi 21MEB0B36
ASSIGNMENT - 1
COMMUNICATION SYSTEMS (EC395)
Question 1: Consider the following CT signals. UNIT IMPULSE, UNIT STEP, UNIT SINE, UNIT
PULSE, UNIT SINC PULSE.
Ans 1:
% Define time vector
t = -5:0.01:5; % Define a time range
% 1. Unit Impulse (δ(t))
impulse = zeros(size(t));
impulse(t==0) = 1
% 2. Unit Step (u(t))
step = zeros(size(t));
step(t>=0) = 1;
% 3. Unit Sine (sin(t))
sine = sin(t);
% 4. Unit Pulse (p(t))
pulse = zeros(size(t));
pulse(abs(t)<=1) = 1;
% 5. Unit Sinc Pulse (sinc(t))
sinc_pulse = sin(pi*t)./(pi*t);
sinc_pulse(t==0) = 1; % Make sure to handle the singularity at t=0
% Plotting
subplot(3,2,1);
plot(t, impulse);
title('Unit Impulse');
xlabel('Time');
ylabel('Amplitude');
Krishnanshu belwanshi 21MEB0B36
subplot(3,2,2);
plot(t, step);
title('Unit Step');
xlabel('Time');
ylabel('Amplitude');
subplot(3,2,3);
plot(t, sine);
title('Unit Sine');
xlabel('Time');
ylabel('Amplitude');
subplot(3,2,4);
plot(t, pulse);
title('Unit Pulse');
xlabel('Time');
ylabel('Amplitude');
subplot(3,2,5);
plot(t, sinc_pulse);
title('Unit Sinc Pulse');
xlabel('Time');
ylabel('Amplitude');
% Adjust plot layout
sgtitle('CT Signals Simulation');
% Uncomment the line below to save the figure as an image file
% saveas(gcf, 'CT_Signals_Plot.png');
Krishnanshu belwanshi 21MEB0B36
Question 2: Evaluate the FT for the above signals. Give the numerical and waveform models in
both time and frequency domains.
Ans 2:
% Define frequency range for the Fourier Transform
omega = -10:0.01:10;
% Fourier Transforms
% 1. Unit Impulse (δ(t))
ft_impulse = fftshift(fft(impulse));
% 2. Unit Step (u(t))
ft_step = 1./(1j*omega) + pi*dirac(omega);
% 3. Unit Sine (sin(t))
omega0 = 2*pi; % Frequency of sine wave
ft_sine = pi*(dirac(omega - omega0) - dirac(omega + omega0));
% 4. Unit Pulse (p(t))
ft_pulse = sinc(omega/2);
% 5. Unit Sinc Pulse (sinc(t))
Krishnanshu belwanshi 21MEB0B36
ft_sinc_pulse = rect(omega);
% Plotting
figure;
subplot(3,2,1);
plot(omega, abs(ft_impulse));
title('FT of Unit Impulse');
xlabel('Frequency (\omega)');
ylabel('Magnitude');
subplot(3,2,2);
plot(omega, abs(ft_step));
title('FT of Unit Step');
xlabel('Frequency (\omega)');
ylabel('Magnitude');
subplot(3,2,3);
plot(omega, abs(ft_sine));
title('FT of Unit Sine');
xlabel('Frequency (\omega)');
ylabel('Magnitude');
subplot(3,2,4);
plot(omega, abs(ft_pulse));
title('FT of Unit Pulse');
xlabel('Frequency (\omega)');
ylabel('Magnitude');
subplot(3,2,5);
plot(omega, abs(ft_sinc_pulse));
title('FT of Unit Sinc Pulse');
xlabel('Frequency (\omega)');
ylabel('Magnitude');
sgtitle('Fourier Transforms of CT Signals');
% Uncomment the line below to save the figure as an image file
% saveas(gcf, 'FT_CT_Signals_Plot.png');
Krishnanshu belwanshi 21MEB0B36
Question 3: Find and plot their power spectrum.
Ans 3:
% Define time vector
t = -5:0.01:5; % Define a time range
% 1. Unit Impulse (δ(t))
impulse = zeros(size(t));
impulse(t==0) = 1;
% 2. Unit Step (u(t))
step = zeros(size(t));
step(t>=0) = 1;
% 3. Unit Sine (sin(t))
sine = sin(t);
% 4. Unit Pulse (p(t))
pulse = zeros(size(t));
Krishnanshu belwanshi 21MEB0B36
pulse(abs(t)<=1) = 1;
% 5. Unit Sinc Pulse (sinc(t))
sinc_pulse = sin(pi*t)./(pi*t);
sinc_pulse(t==0) = 1; % Make sure to handle the singularity at t=0
% Plotting
figure;
subplot(3,2,1);
plot(t, impulse);
title('Unit Impulse');
xlabel('Time');
ylabel('Amplitude');
subplot(3,2,2);
plot(t, step);
title('Unit Step');
xlabel('Time');
ylabel('Amplitude');
subplot(3,2,3);
plot(t, sine);
title('Unit Sine');
xlabel('Time');
ylabel('Amplitude');
subplot(3,2,4);
plot(t, pulse);
title('Unit Pulse');
xlabel('Time');
ylabel('Amplitude');
subplot(3,2,5);
plot(t, sinc_pulse);
title('Unit Sinc Pulse');
xlabel('Time');
ylabel('Amplitude');
Krishnanshu belwanshi 21MEB0B36
sgtitle('Continuous-Time Signals');
% Uncomment the line below to save the figure as an image file
% saveas(gcf, 'CT_Signals_Plot.png');
Question 4: Define stationary and ergodic random processes. Give the expressions for their ACF
and PSD.
Ans 4: 1. **Stationary Random Process:**
A stochastic process is said to be stationary if all its statistical properties, such as mean, variance,
and correlation, remain constant over time. There are different types of stationarity:
- **Strict Stationarity:** The joint probability distribution of any set of time index-shifted random
variables is identical to the original distribution.
- **Weak Stationarity:** Only the first and second moments (mean and variance) are constant over
time. This is also called second-order stationarity.
**ACF and PSD for Stationary Random Process:**
- **Auto-Covariance Function (ACF):** For a stationary random process, the ACF only depends on
the time difference between two points and not on the absolute time at which they occur.
Mathematically, the ACF \( R_x(\tau) \) is defined as:
Krishnanshu belwanshi 21MEB0B36
\[ R_x(\tau) = \text{E}[X(t)X(t+\tau)] - \mu^2 \]
Where:
- \( X(t) \) is the random process.
- \( \mu \) is the mean of the process.
- \( \tau \) is the time difference.
- **Power Spectral Density (PSD):** The PSD of a stationary random process represents the
distribution of power per unit of frequency. It's the Fourier transform of the ACF and is given by:
\[ S_x(f) = \mathcal{F}\{R_x(\tau)\} \]
Where:
- \( S_x(f) \) is the PSD of the process.
- \( \mathcal{F} \) represents the Fourier transform.
- \( f \) is the frequency.
2. **Ergodic Random Process:**
An ergodic random process is one where the temporal averages of a single realization of the
process over an infinitely long time period are equal to the statistical averages over the ensemble of
all possible realizations of the process. In simpler terms, it implies that time averages and ensemble
averages are equivalent.
**ACF and PSD for Ergodic Random Process:**
- For an ergodic random process, the ACF and PSD can be estimated using a single realization of the
process over a sufficiently long time period. These estimates converge to the true ACF and PSD as the
duration of the realization tends to infinity.
In summary, stationary random processes have constant statistical properties over time, while
ergodic random processes exhibit equivalence between time and ensemble averages. The ACF and
PSD describe the temporal and frequency characteristics of these processes, respectively.
Question 5: Give the expressions and waveform plots of the pdf, ACF and PSD for following
random signals: Gaussian, White and Uniform
Ans 5:
% Define parameters
mu = 0; % Mean for Gaussian
sigma2 = 1; % Variance for Gaussian and White
range_min = -1; % Minimum value for Uniform
range_max = 1; % Maximum value for Uniform
Krishnanshu belwanshi 21MEB0B36
% Time parameters
T = 1000; % Length of the signal
t = 0:T-1; % Time vector
% Generate signals
gaussian_signal = mu + sqrt(sigma2)*randn(1, T);
white_signal = sqrt(sigma2)*randn(1, T);
uniform_signal = range_min + (range_max-range_min)*rand(1, T);
% Plot PDF
figure;
subplot(3, 1, 1);
histogram(gaussian_signal, 'Normalization', 'pdf');
title('PDF of Gaussian Signal');
xlabel('Value');
ylabel('Probability Density');
subplot(3, 1, 2);
histogram(white_signal, 'Normalization', 'pdf');
title('PDF of White Signal');
xlabel('Value');
ylabel('Probability Density');
subplot(3, 1, 3);
histogram(uniform_signal, 'Normalization', 'pdf');
title('PDF of Uniform Signal');
xlabel('Value');
ylabel('Probability Density');
% Plot ACF
figure;
subplot(3, 1, 1);
autocorr(gaussian_signal);
title('ACF of Gaussian Signal');
subplot(3, 1, 2);
autocorr(white_signal);
Krishnanshu belwanshi 21MEB0B36
title('ACF of White Signal');
subplot(3, 1, 3);
autocorr(uniform_signal);
title('ACF of Uniform Signal');
% Plot PSD
figure;
subplot(3, 1, 1);
pwelch(gaussian_signal);
title('PSD of Gaussian Signal');
subplot(3, 1, 2);
pwelch(white_signal);
title('PSD of White Signal');
subplot(3, 1, 3);
pwelch(uniform_signal);
title('PSD of Uniform Signal');
Krishnanshu belwanshi 21MEB0B36