You are on page 1of 23

Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India.

AY 2023-24

Department of ECE
Digital Communication (22EC2208) AY 2023-24
Module-3: Filtering the Communication Signals
The main aim of this module is to study and gain the knowledge of filtering the communication
signals in both time domain and frequency domain.

Skilling Objectives:

(a) Convolution of two signals.


(b) Generation of Additive White Gaussian Noise and its power spectral density.
(c) Noise eliminating using Average Filtering technique.
(d) Noise suppression using convolution-based filtering technique.
(e) FFT-based filtering technique for Noise suppression.
(f) Filtering effects on communication signals.

3.1 Introduction:
Linear and time invariant LTI systems are particularly important classes of systems has
significant signal processing applications. These systems satisfy both the linearity and time-
invariant properties which is desired properties for real time applications. The processing of
signals in time domain through continuous time (or Discrete time) systems are usually referred
to as convolution or filtering operation.

The processing of signals using convolution leads to computationally intensive for long data
records. On the other hand, processing operations in the frequency domain are much faster
because of two reasons:
(i) by taking advantages of property of FT: i.e., convolution of two signals in time domain leads
to multiplication in the frequency domain, which is simple operation than convolution,
(ii) faster algorithms are available for computing FT due to technological development.

The filtering techniques used in this project are illustrated briefly in the following figure.
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

Fig4.1. Filtering techniques

3.2 Time Domain Analysis of CT Systems: Convolution operation.


The block diagram of CT system is illustrated in the following figure.

Fig 4.2. LTI system

Let is an input sequence applied to an CT, LTI system characterized by an impulse

response . Then the output of the system is described mathematically by,

is known as convolution integral equation. This operation is also known as filtering the signals in
the signal processing community.

Worked Examples (WE): The analytical solutions and corresponding Matlab scripts written for
following examples are provided to understand and gain programming skills.

WE 3.1: Linear Convolution of two signals, a rectangular pulse and a delayed /


shifted impulse.

Consider a rectangular pulse having unit width, unit height and centered at origin is applied

to a CT system with impulse response, a delayed impulse signal . It is desired


to find the response of the system using convolution.
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

Solution: The given signals are defined and shown below:

Fig 4.3. Graphical representation of signals for WE 4.1


Analytical solution:

By property of convolution, , the response of the system is the delayed

version of input signal by as shown below.

Fig 3.3. Response of the system for WE3.1.

The Matlab script for the given example is given below:

% Developed by Dr. M. Venu Gopala Rao, Professor, Dept. of ECE,


% KL University, Vaddeswaram, Guntur Dt., A.P., India.
% Email: mvgr03@kluniversity.in, mvgr03@gmail.com.

clear; close all; clc;


t = -1:0.001:5; % Set time index

% Define signal x(t) a rectangular pulse having unit height and unit width
% centered at origin.
w = 1; % Width of the pulse centered at origin
x = rectpuls(t, w);

% Define signal h(t) a shifted delta function h(t)=delta(t-0.5)


h = zeros(1,length(t));
h(t == 0.5)=1;

y = (0.002)*conv(x,h);
t2 = -2:0.001:10; % Time index for y(t)
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

figure();set(gca,'fontsize',14);
subplot(3,1,1);plot(t, x,'m','LineWidth',3);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);
ylabel('Amplitude ----->','FontSize',14);
title('x(t)','FontSize',16); axis([-1 3 -0.2 1.2]);
xline(0,'k','LineWidth',2);yline(0,'k','LineWidth',2);

subplot(3,1,2);plot(t, h,'b','LineWidth',3);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);
ylabel('Amplitude ----->','FontSize',14);
title('h(t)','FontSize',16);axis([-1 3 -0.2 1.2]);
xline(0,'k','LineWidth',2);yline(0,'k','LineWidth',2);

subplot(3,1,3);plot(t2, y/0.002,'r','LineWidth',3);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);

ylabel('Amplitude ----->','FontSize',14);
title('y(t)=x(t)*h(t)','FontSize',16);axis([-1 3 -0.2 1.2]);
xline(0,'k','LineWidth',2);yline(0,'k','LineWidth',2);

3.2.1: Practice problems (PP) on convolution: Students are instructed to work out the
analytical solutions for the following problems, develop Matlab codes, simulate and verify the
results.
Task1: Determine analytically the convolution of the following signals, and verify your answers

using the Matlab. and


Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

% Define the time range


t = 0:0.01:5; % Choose an appropriate range

% Define the signals x(t) and h(t)


x = exp(-t) .* (t >= 0); % x(t) = e^-t * u(t)
h = (t >= 0) - (t >= 1); % h(t) = u(t) - u(t-1)

% Compute the convolution using conv()


y = conv(x, h) * 0.01; % Discrete convolution, multiplied by the step size for
integration

% Define the time vector for the convolution result


t_conv = 0:0.01:(length(y)-1)*0.01;

% Plot the signals and their convolution


figure;
subplot(3,1,1);
plot(t, x);
xlabel('t');
ylabel('x(t)');
title('Signal x(t) = e^{-t}u(t)');

subplot(3,1,2);
plot(t, h);
xlabel('t');
ylabel('h(t)');
title('Signal h(t) = u(t) - u(t-1)');

subplot(3,1,3);
plot(t_conv, y);
xlabel('t');
ylabel('y(t)');
title('Convolution of x(t) and h(t)');
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

Task2: An LTI system consists of two sub-systems and in cascaded as shown below.

Fig 3.4. Cascaded system

The impulse response of these systems are and respectively, given by

and .

(a) Find the resultant impulse response of the cascaded system .

(b) Find the response of the system if it is excited by an input signal


% Define the time range
t = 0:0.01:10; % Choose an appropriate range

% Define the impulse responses h1(t) and h2(t)


h1 = t .* (t >= 0) - 2 * exp(-t) .* (t >= 0);
h2 = exp(t) .* (t >= 0);

% Compute the convolution to get h(t)


h = conv(h1, h2) * 0.01; % Discrete convolution, multiplied by the step size for
integration

% Define the time vector for the resultant impulse response


t_conv = 0:0.01:(length(h)-1)*0.01;

% Plot the resultant impulse response


Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

plot(t_conv, h);
xlabel('t');
ylabel('h(t)');
title('Resultant Impulse Response h(t) of the Cascaded System');
3.3 Noise: Electrical noise is defined as undesirable electrical energy that falls within the pass
band of the signal. For example, in the transmission of RF signal, any unwanted electrical signals
that fall within the audio frequency band of 0 Hz to 15 kHz will interfere with the music and therefore
be considered as noise.

Let denote a noisy signal. Then the values of noisy signal are unpredictable and only a

probability can be associated to them, . The most common type of noise found in
a communication system is Gaussian with PDF

where Mean value , and Variance


The noise analysis in communication system is based on an
idealized for of noise process called white noise. If the noise

is additive, then mean value . The power spectral


density of this noise is considered to be independent of
frequency. Fig.1 White Noise power spectral density

The power spectral density of the white noise process is represented as

.
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

where is the average noise power per unit band width of white noise measured in watt / Hz,
and the factor ½ has been included to indicate the half of the power is associated with the
positive frequency and remaining half of with the negative frequencies as shown in the figure
Fig.2.

WE3.2: Develop Matlab script to generate and plot an additive white Gaussian noise (AWGN)
and its power spectral density with mean zero and variance 0.01.

Gaussian Noise and Power spectral density

clear; close all; clc;


Fs = 1e4; % Sampling frequency
t = 0:1/Fs:1-(1/Fs);
% N = size(t,2); % No. of samples
N = length(t);
% Defining the noise parameters
mu = 0; % zero mean
disp('Zero mean')

Zero mean

var = 0.01

var = 0.0100

sigma = sqrt(var)

sigma = 0.1000

var_dB = 10*log(var)

var_dB = -46.0517

Generating the Random Process

%Generating the Random Process


X = sqrt(var)*randn(N,1) + mu

X = 10000×1
-0.1809
0.1060
0.1755
-0.0477
0.0563
-0.0095
-0.2099
-0.0882
-0.1495
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

0.0907

% X = sigma*randn(size(t))

Listen the noise

sound(X,Fs);

Plot the White Gaussian Noise

figure();
stem(X,'m','fill','LineWidth',2);
% title('White noise');
title(['White noise : \mu_x=',num2str(mu),' \sigma^2=',num2str(sigma^2)])
xlabel('Samples'); ylabel('Sample values');
axis([0 25 -0.5 0.5]);

Spectrum of White noise

% Frequency axis
% N = length(t);
f = (-N/2:1:N/2-1)*Fs/N;

% Spectrum of message signal


Xf = (2/N)*fftshift(fft(X));

plot(f,abs(Xf)/max(abs(Xf)),'b','LineWidth',2);
title('Spectrum of White Noise');
axis([-1000 1000 -0.01 1]);grid on
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

xlabel('Frequency --->');ylabel('Magnitude--->');

Power Spectral Density

[pxx,f] = pwelch(X,[],[],[],Fs);

plot(f/1000,pow2db(pxx),'m','LineWidth',1);
axis([0 5 -120 -40]); grid
title('PSD of AWGN Noise');
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

Task3: Develop Matlab script to generate and plot an additive white Gaussian noise (AWGN)
and its power spectral density with the following specifications:

mean zero and variances (i) 0.05 (ii) 0.5 (iii) 1.

% Define parameters
Fs = 1000; % Sampling frequency (Hz)
T = 1; % Duration of the signal (seconds)
t = 0:1/Fs:T-1/Fs; % Time vector

% Define variances
variances = [0.05, 0.5, 1];

% Plot AWGN and PSD for each variance


for i = 1:length(variances)
% Generate AWGN with mean zero and the specified variance
noise = sqrt(variances(i)) * randn(size(t));

% Plot AWGN
subplot(3, 2, 2*i-1);
plot(t, noise);
xlabel('Time (s)');
ylabel('Amplitude');
title(['AWGN with Variance = ', num2str(variances(i))]);
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

% Compute and plot the power spectral density (PSD)


[pxx, f] = pwelch(noise, [], [], [], Fs);
subplot(3, 2, 2*i);
plot(f, 10*log10(pxx));
xlabel('Frequency (Hz)');
ylabel('Power/Frequency (dB/Hz)');
title('Power Spectral Density 2200040248');
xlim([0 Fs/2]); % Limit the x-axis up to the Nyquist frequency
end

3.4. Filtering the communication signals: The signals are usually corrupted by
unwanted noise and undesired frequency components while acquisition. Hence it is desired to
filter or suppress the undesired signal components and noise. Filtering the signals can be done
both in time domain and frequency domain.

3.4.1: Time domain filtering: Convolution operation discussed in section 3.2 is also referred
to as filtering in time domain. Another time domain filter is known as average filtering is
illustrated below,

3.4.1(a) Averaging filter: The averaging filter is used in smoothing random variations in data.

An averaging filter is defined by , where is the duration

of the moving average window. or in discrete time


Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

WE3.3: Consider a sinusoidal signal . Run the following Matlab


code and observe the results.

clear; close all; clc;

N = 2001; Fs=8000; Ts = 1/Fs;


t = (-(N-1)/2:1:(N-1)/2)*Ts;
x = sin(2*pi*600*t); %original signal

% Listen the sound


% sound(x,Fs); pause
% sound([x x x x x x],Fs);

Suppose now this signal is corrupted by an additive White Gaussian noise


(AWGN) with variance of 0.1. In Matlab, the following commands are used to
generate noisy signal. (Refer the appendix-A for noise).

v =.01; % Noise variance


r = sqrt(v)*randn(size(x)); %noise
xn = x + r; %signal plus noise (filter input)

Average Filter:

By taking the average of the signal for n-point values, the noise will reduce. The
following Matlab code is used with n= 3.

ya = zeros(size(x));
for n=3:length(xn) % 3 point averaging filter
ya(n)=sum(xn(n-2:n))/3; %y[n] is the filtered signal
end

Now plot the signal and observe the denoised signal. The following Matlab code
is used to plot the signals.

figure();
subplot(3,1,1); plot(t,x,'r','LineWidth',1.5);
axis([-0.005 0.005 -1.2 1.2]);
title('Original Signal'); xlabel('Time ----->');
ylabel('Amplitude---->');

subplot(3,1,2); plot(t,xn,'b','LineWidth',1.5);
axis([-0.005 0.005 -1.2 1.2]);
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

title('Noisy Signal'); xlabel('Time ----->');


ylabel('Amplitude---->');

subplot(3,1,3); plot(t,1.2*ya,'m','LineWidth',1.5);
axis([-0.005 0.005 -1.2 1.2]);
hold on; plot(t,x,'k--','LineWidth',1.5);
axis([-0.005 0.005 -1.2 1.2]);
legend('Denoised', 'Original');
title('Denoised Signal'); xlabel('Time ----->'); ylabel('Amplitude---->');

Listen the sounds and compare with the following commands

% % Listen the sound


% pause
% sound([xn xn xn xn xn xn],Fs);
% pause
% sound(1.3*[ya ya ya ya ya ya],Fs);

Task4: Now change to n = 5, 7, 9, . . . 21 point average filter. For example, 7 point averaging
filter the modified code is given below. Find the phase difference for each case and tabulate.
Comment on the results.
for n=7:length(xn) % 7 point average filter
ya(n)=sum(xn(n-6:n))/7; %y[n] is the filtered signal
end
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

Listen the sounds and compare with the following commands

% sound([x x x x x],Fs); pause


% sound([xn xn xn xn xn],Fs);pause
% sound([ya ya ya ya ya],Fs);

Task5: Now change the variance for various values and observe the results. Comment on the
results.

3.4.1(b) Filtering using Convolution: We will solve the problem of denosing using
convolution algorithm:

WE3.4: Consider a sinusoidal signal . Suppose now this signal is


corrupted by an additive White Gaussian noise (AWGN) with variance of 0.1.
Develop the Matlab code for denoising using convolution operation.
Let us define a sync function as a impulse response of the system, since the
signal frequency is 600 Hz. The filtering the signal is illustrated in the following
commands.

% A sinc function with a cut-off frequency of 600 Hz.


% Generation of impulse response h(t)
h = sinc(1200*t);

%======== Convolution Operation ==================


yc = conv(xn,h,'same');
yc = real(yc);

Plot the reconstructed signal y(t) and compare with the original signal.

figure();
subplot(3,1,1); plot(t,x,'r','LineWidth',1.5);
axis([-0.005 0.005 -1.2 1.2]);
title('Original Signal'); xlabel('Time ----->');
ylabel('Amplitude---->');

subplot(3,1,2); plot(t,xn,'b','LineWidth',1.5);
axis([-0.005 0.005 -1.2 1.2]);
title('Noisy Signal'); xlabel('Time ----->');
ylabel('Amplitude---->');

subplot(3,1,3); plot(t,real(yc),'m','LineWidth',1.5);
axis([-0.005 0.005 -4.2 4.2]);
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

title('convolution based filtered signal');


xlabel('Time ----->'); ylabel('Amplitude---->');

Listen the sounds and compare with the following commands

% sound([x x x x x x],Fs); pause


% sound([xn xn xn xn xn xn],Fs);pause
% sound([yc yc yc yc yc yc],Fs);

3.5: Frequency domain filtering:


Refer the Module 3 for frequency domain representation of various signals.
The frequency domain filtering process is illustrated in the following steps

Fig 3.6 Filtering operation in frequency domain

Step1: Compute the spectrum (FT) of the input signal.


Step2: Compute the frequency response of the system. That is spectrum / FT of the
impulse response of the system.

Step3: Perform the element wise multiplication of signal spectra to


Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

obtain .

Step4: Perform the inverse FFT to obtain filtered signal .

WE3.5: Consider a sinusoidal signal . Suppose now this signal is


corrupted by an additive White Gaussian noise (AWGN) with variance of 0.1.
Develop the Matlab code for denoising using frequency domain filtering.
Consider the noisy signal xn as illustrated in previous example.

% Determining the spectrum of signal


F = (-(N-1)/2:1:(N-1)/2)*Fs/N; % Frequency grid
Xn = (2/N)*fftshift(fft(xn)); % Spectrum of noisy signal

% System function
H = (2/N)*fftshift(fft(h)); % System function

% Multiplication of the spectrums of Sinusoidal signal and


% system function.
Y = Xn.*H;

% Inverse FT of 'Y'
yf = ifft(ifftshift(Y));
yf = real(yf);
yf = yf / max(yf);

figure();
subplot(3,1,1); plot(t,x,'r','LineWidth',1.5);
axis([-0.005 0.005 -1.2 1.2]);
title('Original Signal'); xlabel('Time ----->');
ylabel('Amplitude---->');
subplot(3,1,2); plot(t,xn,'b','LineWidth',1.5);
axis([-0.005 0.005 -1.2 1.2]);
title('Noisy Signal'); xlabel('Time ----->');
ylabel('Amplitude---->');
subplot(3,1,3); plot(t,real(yf),'m','LineWidth',1.5);
axis([-0.005 0.005 -1.2 1.2]);
title('Frequency domain filrered signal');
xlabel('Time ----->'); ylabel('Amplitude---->');
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

Listen the sounds and compare with the following commands.

% sound([x x x x x x],Fs); pause


% sound([xn xn xn xn xn xn],Fs);pause
% sound([yf yf yf yf yf yf],Fs);

Comparison the three filters

figure();
plot(t,x,'r','LineWidth',1.5); hold on
plot(t,real(ya),'b','LineWidth',1.5); hold on
plot(t,real(yc)/4,'g.-','LineWidth',1.5); hold on
plot(t,real(yf),'k--','LineWidth',1.5); hold on
axis([-0.005 0.005 -1.2 1.2]);
legend('Original', 'Average','Convolution', 'FFT');
hold off

Task6: Now change the variance for various values and observe the results. Comment on the
results.
3.6 Filtering effects on communication signals:
The filters are broadly classified as low pass filter (LPF), high pass filter (HPF), band pass filter
(BPF) and band rejection filter (BRF). The following example illustrates the effectiveness of various
filters on a speech signal.

WE3.6: Load a speech signal ‘speech.wav’. Plot this signal and its spectrum. From the spectrum
find the highest frequency.

clear; close all; clc;


Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

% [data Fs] = audioread('speech.wav');


% sound(data, Fs);

% data = load('mclips.mat');
% sound(data);

% [data Fs] = audioread('six.wav');


[data, Fs] = audioread('bird.wav');
sound(data, Fs);

Then do the following filtering operations.

3.5 (a) Low Pass Filter(LPF): Choose a cut off frequency of 2200 Hz. Then use the
following commands for LPF.

%================== LPF================
% Choose cut-off frequency ___ Hz.
Fc1 = 2200; % Cut-off frequency in Hz.
[b, a] = butter(12, (2/Fs)*Fc1);
y_lpf = filter(b,a, data);

% Listen the sound


sound(20*y_lpf, Fs);

Task7: Plot the original speech and low pass filtered speech signal and their spectrum.
Conclude your observations.

3.6 (b) High Pass Filter (HPF): Choose a cut off frequency of 1200 Hz. Then use
the following commands for HPF.

%================ HPF ==============


% Choose cut-off frequency____ Hz.
Fc2 = 1200; % Cut-off frequency in Hz.
[b, a] = butter(8, (2/Fs)*Fc2,'high');
y_hpf = filter(b,a, data);

% Listen the sound


sound(y_hpf, Fs);

Task8: Plot the original speech and high pass filtered speech signal and their spectrum.
Conclude your observations.
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

4.5 (c) Band Pass Filter(BPF): Choose a cut off frequencies 1200 Hz and 2200 Hz. Then
use the following commands for BPF.

%============= BPF =========================


% Choose cut-off frequencies
Fl = 1200; Fh = 2200 ; % Cut-off frequencies in Hz.
[b, a] = butter(4, (2/Fs)*[Fl Fh]);
y_bpf = filter(b,a, data);

% Listen the sound


sound(12*y_bpf, Fs);

Task9: Plot the original speech and band-pass filtered speech signal and their spectrum.
Conclude your observations.

4.5 (d) Band rejection Filter(BPF): Choose a cut off frequencies 1500 Hz and 1600 Hz. Then
use the following commands for BPF.

%============== BPF =========================


% Choose cut-off frequencies
Fl = 1500; Fh = 1600 ; % Hz.
[b, a] = butter(4, (2/Fs)*[Fl Fh],'stop');
y_brf = filter(b,a, data);

% Listen the sound


sound(y_brf, Fs);

Task10: Plot the original speech and band rejection filtered speech signal and their spectrum.
Conclude your observations.

3.7. Project Assignments: Students are instructed to work out the following Project
Assignment tasks.
3.7.1 Project Assignment1: Filtering the undesired frequency component and noise.

Problem statement: A low frequency sinusoidal signal is acquired for a particular

application. Unfortunately, the signal is corrupted by the power line signal while
acquisition. Now it is desired to remove the power line signal.

Let and so that the corrupted signal is

. Sketch these signals.


Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

Task PA1 Time domain filtering: Perform both time domain filtering (averaging filtering and
convolution operation) techniques.
Noiseless case: Consider the signal is not degraded further by noise.
Task PA1.1 Averaging filter: Perform the N-point averaging filter, for N = 7, 15, 27 and
observe the results. Whether the undesired signal component is suppressed or not? Comment
on each case.
Task PA1.2 Convolution operation: Since the desired signal frequency is 5 Hz, select the

impulse response of the filter as , with say Hz same as the undesired


signal frequency.
 Plot the impulse response of the system. What is the shape of this signal?

Perform the convolution operation (filtering) between and using the


command y = conv(s, h);

 Find the length of the signal , and correspondingly define the time index for display
the signal.
 Perform the convolution operation by typing the following command
y = conv(s, h, ‘same’);

Find the length of the signal and compare with the results above step and
comment.

 Plot the signal . Is it a desired signal? Overlap the 5 Hz signal on and


compare. Are these two signals having the same frequency and phase? Comment.

 Repeat the above for .

Task PA1.3 Noisy case: Suppose the signal is degraded further by additive white

Gaussian noise (AWGN) with variance . Let the noisy signal is referred to as

, where is additive noise. Plot the noisy signal .


Task PA1.4 Repeat the averaging filter if the signal is noisy case.
Task PA1.5 Repeat the convolution-based filtering operation for noisy case. Repeat for

.
3.7.2 Frequency domain filtering: As mentioned earlier the convolution operation is
computationally intensive for long data. By the convolution theorem of FT, the convolution of
two signals in the time domain leads to multiplication in the frequency domain. By taking the
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

advantages of this property, undesired signals and noise can be filtered in the frequency
domain.

Task PA2.1 (a) Noiseless case: Again, consider the signal is not degraded further by noise.

 Find and sketch spectrum of the following signals . Let these

signals are named as . Discuss the shape of these


signals?

 Perform the element wise multiplication of signals to obtain

. Plot these spectra in a single plot, one below another.

 Perform the inverse FT to obtain . Plot the signal and its spectrum.

 Observe the plot of the signal . Is it a desired signal? Overlap the 5 Hz original

signal on and compare. Are these two signals having the


same frequency and phase? If any deviation find its value. Comment.

 Repeat the above for .


Task PA2.b (b) Noisy case: Repeat the above steps for noisy case.

Appendix-A: Real time signals

1. Speech signal: The speech signal has frequency components in the audio frequency
range 20 Hz to 20 kHz of the electromagnetic spectrum. This is the reason for perceiving
the information present in the speech signal by human ears. Since sound signals are
represented as vectors in MATLAB, you can do any mathematical operation on the sound
signals that you could do on elements in a vector. In other words, you can create your own
sounds with MATLAB scripts and functions.

To record data from an audio input device (such as a microphone connected to your system)
for processing in MATLAB:

(a) Create an audiorecorder object.

(b) Call the record or recordblocking method, where:

 record returns immediate control to the calling function or the command prompt even as
recording proceeds. Specify the length of the recording in seconds, or end the recording
Digital Coomunication 22EC2208, KLEF Deemed to be University, A.P., India. AY 2023-24

with the stop method. Optionally, call the pause and resume methods. The recording is
performed asynchronously.

 record blocking retains control until the recording is complete. Specify the length of the
recording in seconds. The recording is performed synchronously.

(c) Create a numeric array corresponding to the signal data using the getaudiodata
method.

(d) The recorded data can be listened with play or sound command

(e) Recorded real time speech signal can be saved with save command in different formats
and also load and display to obsever basic parameters of the signals.

(f) Different properties of recorded speech such as BitsPerSample, BufferLength,


SampleRate, TimerPeriod, TotalSamples can be observed by using Matlab command.

You might also like