0% found this document useful (0 votes)
7 views24 pages

Commn. Lab

The lab report focuses on using MATLAB for analyzing continuous-time signals, including generating sinusoidal, exponential, and random signals. It covers the objectives, theory, and practical implementations of these signals, along with their graphical representations and spectral analysis. The report concludes with insights on the significance of these signals in signal processing and communication systems.

Uploaded by

Hizkias Kassahun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views24 pages

Commn. Lab

The lab report focuses on using MATLAB for analyzing continuous-time signals, including generating sinusoidal, exponential, and random signals. It covers the objectives, theory, and practical implementations of these signals, along with their graphical representations and spectral analysis. The report concludes with insights on the significance of these signals in signal processing and communication systems.

Uploaded by

Hizkias Kassahun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

INTRODUCTION TO COMMUNICATION (LAB- REPORT)

Experiment 1
1. Objectives and introduction
1.1 Introduction
MATLAB and its applications in analysis of continuous-time signals will be practiced. The
purpose of this lab is is to discuss the way MATLAB is used in analysis of different types of
signals. The areas covered are designed to enforce Signal Generation and Presentation and
Spectral analysis. MATLAB is a tool for doing numerical computations with matrices and
vectors. It can also display information graphically. MATLAB only deals with discrete time
signals, continuous time signals are represented in the form of discrete time signals. MATLAB
allows you to add, subtract, multiply, divide, scale, and exponential signals. In this experiment
each section provides a series of worked examples followed by a number of investigative
problems.
1.2 Objectives
Generating the deterministic signals such as; sinusoidal signal, exponential signal and
random signal.
2. Theory
Signal is an Abstraction of any measurable quantities that is a function of one or more
independent variables such as time or space .and also a quantities which express a function of
time is called signal .there are different type of signal . lets see one by one :
A. Sinusoidal signal
A continuous version of sinusoidal signal in it most general form ,may be written as :
x( n)= A sin (2πfn/fs+θ)
Where,
f is the signal frequency of the signal.
fs is the sampling frequency of the signal.
θ is the phase of the signal.
A is the amplitude of the signal.
Consider generating 64 samples of a sinusoidal signal of frequency 1KHz, with a sampling
frequency of 8KHz, amplitude of 1 volt and phase shift of 0.
Post lab work
% program: sinusoidal.m
% Generating 64 sample of x(t)=cos(2*pi*f*t) with A=1.5
% Frequency of 25Hz and sampling frequency 400Hz
N=64; % define number of samples

MATLAB-2016.E.C Page 1
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

n=0:N-1; % define vector n=0,1,2,3,...62,63


f=25; % define the frequency
fs=400; % define the sample frequency
a=1.5; % define amplitude
x=a*cos(2*pi*(f/fs)*n); % generate x(t)
plot(n,x); % plot x(t) vs t
grid;
title('cosinewave [f=25Hz, fs=400Hz]');
xlabel('Sample number');
ylabel('Amplitude');
Result

B. Exponential signal generation


Exponential signal is a constant number raised to variable exponent. It plays a major role in the
analysis of signals and systems. It is a signal that describes repetitive oscillation.it is as function
of cosine graph.It has a value returned asa scalar, vector, matrix, or multidimensional array.
There are two types of behaviour:
1. If a is positive x(t) is growing exponential

MATLAB-2016.E.C Page 2
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

2. If a is negative then x(t) decaying


Exponential Generating the signal x(t) = e -0.1t for t = 0 to 40ms in steps of 0.1ms:
Post lab work
%Program Exponential.m
% Generating the signal x(t)=exp(-0.1t)*sin(0.6t)
t=0:0.1:40;

x=exp(-0.1*t);

plot(t,x);

grid;

title('exponential signal');

xlabel('time [mS]');

ylabel('Amplitude');

Result :

C. Random signal
Normally Distributed Random Numbers. Rand (N) is an N-by-N matrix with random entries,
chosen from a normal distribution with mean zero and variance one. Rand (M,N), and rand
([M,N]) are M-by-N matrices with random entries. II. Uniformly Distributed Random Numbers.
Rand (N) is an N-by-N matrix with random entries, chosen from a uniform distribution on the
interval (0,1). Rand (M, N) and rand ([M, N]) are M-by-N matrices with random entries.

MATLAB-2016.E.C Page 3
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

Post lab works


% Program: random.m % Generates Uniformly and Normally Distributed random signals
N=1024; % Define Number of samples
R1=randn(1,N); % Generate Normal Random Numbers
R2=rand(1,N); % Generate Uniformly Random Numbers
figure (1); % Select the figure
subplot(2,2,1); % Subdivide the figure into 4 quadrants
plot(R1); % Plot R1 in the first quadrant
grid;
title('Normal [Gaussian] Distributed Random Signal');
xlabel('Sample Number');
ylabel('Amplitude');
subplot(2,2,2); % Select the second qudrant
hist(R1); % Plot the histogram of R1
grid;
title('Histogram [Pdf] of a normal Random Signal');
xlabel('Sample Number');
ylabel('Total');
subplot(2,2,3);
plot(R2);
grid;
title('Uniformly Distributed Random Signal');
xlabel('Sample Number');
ylabel('Amplitude');
subplot(2,2,4);
hist(R2);
grid;
title('Histogram [Pdf] of a uniformly Random Signal');
xlabel('Sample Number');
ylabel('Total');
Result :

MATLAB-2016.E.C Page 4
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

Conclusion
A.Sinusoidal
Inconclusion, the sinusoidal signal is a fundamental concept in signal processing and
communication systems . MATLAB provides a powerful tool for generating and analyzing
sinusoidal signals. Through this report, we have learned how to create and plot sinusoidal
signals with different frequencies, amplitudes, and phases using MATLAB. We have also
explored the Fourier series representation of periodic signals and the concept of harmonics.
Furthermore, we have discussed the importance of sinusoidal signals invarious applications,
such as audio processing, telecommunications, and control systems. Overall, the knowledge
gained from this report will be useful in understanding and designing various signal processing
systems.
B.Exponetial Signal
In conclusion, the exponential signal is another important concept in signal processing and
communication systems. MATLAB provides a powerful tool for generating and analyzing
exponential signals. Through this report, we have learned how to create and plot exponential
signals with different time constants and amplitudes using MATLAB. We have also explored the
relationship between exponential signals and the Laplace transform. Furthermore, we have
discussed the importance of exponential signals in various applications, such as circuit analysis,
control systems, and digital signal processing. Overall, the knowledge gained from this report

MATLAB-2016.E.C Page 5
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

will be useful in understanding and designing various signal processing systems that involve
exponential signals.
C.Random Signal
In conclusion, random signals are an important concept in signal processing and communication
systems. MATLAB provides a powerful tool for generating and analyzing random signals.
Through this report, we have learned how to create and plot different types of random signals,
such as white noise and Gaussian noise, using MATLAB. We have also explored the statistical
properties of random signals, such as mean, variance, and autocorrelation. Furthermore, we
have discussed the importance of random signals in various applications, such as channel
modeling, system identification, and signal analysis. Overall, the knowledge gained from this
report will be useful in understanding and designing various signal processing systems that
involve random signals.

MATLAB-2016.E.C Page 6
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

Experiment 2
objective :
1 Sinusoidal signal generation:
N=256;
fs=8000;
f=1000;
n=0:N-1;
x=sin(2*pi*(f/fs)*n);
x=fft(x); magx=abs(x);
fx=0:(N/2)-1;
f=0,1,2,...(N/2)-1
fx=(fx*fs)/N;
figure(1);
subplot(1,1,1);
plot(fx,20*log10(magx(1:N/2)));
grid;
title('Spectrum of a sinsoidal signal with f=1KHz');
xlabel('Frequency(Hz)');
ylabel('Magnitude (dB)');

MATLAB-2016.E.C Page 7
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

MATLAB-2016.E.C Page 8
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

 X(t)=sin(2t); canbe represented in matlab as a 1xN matrix as follows


Ts=0.1;
N=100;
t=(0:N-1)*Ts;
x=sin(2*t),
plot(t,x);
grid on
xlabel('time-secs')
ylabel('signal x')
title('plot of x vs t')

# You can also use the command to plot several signals on the same graph:
Ts=0.1;
N=100;
t=(0:N-1)*Ts;
x=sin(2*t),
y=2*x;
plot(t,x,'-',t,y,'--');
gird
xlabel('time-secs')
ylabel('signal x')
title('plot of x and y vs t')

MATLAB-2016.E.C Page 9
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

##@ Samles signal & sound


### % writting an m-file
T=10,
Fs=8000;
f=440;
t=0:1/Fs:T;
n=T+Fs;
x=4*exp(-2*t).*sin(2*pi*f*t);
plot(t(1:n),x(1:n),'r')
grid
xlabel('time-secs')
ylabel('signal value-volts')
title('A plot of a sample signal')
sound(x,FS)

MATLAB-2016.E.C Page 10
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

MATLAB-2016.E.C Page 11
INTRODUCTION TO COMMUNICATION (LAB- REPORT)
## Sinusoidal signal generation
N=64; % define number of samples
n=0:N-1;%define the vector n=0,1,2,......,62,63
f= 1000;%define the frequency
fs=8000;%define the sampling requency
x=sin(2*pi*(f/fs)*);%generate x(t)
plot(n,x);%plot x(t) vs.t
grid;
title(['sine wave ['f=1khz,fs=8khz]');
xlabel('sample number');
ylabel('amplitude');

##@ Exponential signal generation


T=0:0.1:40;
x=exp(-0.1*t);
plot(t,x);
grid;
title('exponential signal');
xlabel('time [mS]');
ylabel
%program:random.m
%generates uniformly and normally distributed random signals
N=1024;%define number of samples
R1=radn(1,N);%generate normal random numbers
R2=rad(1,N);%generate uniformly random numbers
figure(1);%select figure
subplot(2,2,1);%subdivide the figure into 4 quadrants
plot(R1);%plot R1 in the first quadrant
grid;
title('normal[gaussian] distributed random signals');
xlabel('sample number ');
ylabel('Amplitude');
subplot(2,2,2);%select the second quadrant

MATLAB-2016.E.C Page 12
INTRODUCTION TO COMMUNICATION (LAB- REPORT)
hist();%plot the histogram of R1
grid;
title('Histogram[pdf]of a normal random signal');
xlabel('Sample number ');
ylabel('Total');
subplot(2,2,3);
plot(R2);
grid;
title('uniformly distributed random signal');
xlabel('sample number');
ylabel('amplitude');
subplot(2,2,4);
hist(R2);
grid;
title('Histogram[pdf]of uniformly random signal');
xlabel('sample number');
ylabel('Total');

##@ Signal manupulation


N=128;
f1=150;
f2=450;
f3=1500;
fs=8000;
n=0:N-1;
x1=sin(2*pi*(f1/fs)*n);
x2=(1/3)*sin(2*pi*(f2/fs)*n);
x3=sin(2*pi*(f3/fs)*n);
figure(1)
subplot(1,1,1);
subplot(2,3,1);
plot(n,x1);
grid
title('signal,x1(n)');
subplot(2,3,2);
plot(n,x2);
grid;
title('signal,x2(n)');
subplot(2,3,3);
plot(n,x3);
grid
title('signal ,x3(n)');
% signal Delay
x1d=[zeros(1,20),x1(1:N-20)];
subplot(2,3,4);
plot(n,x1d);
grid;
title('Delayed x(n),[x1(n-20)]');
% signal Addition
xadd=x1+x2;
subplot(2,3,5);
plot(n,xadd);
grid

MATLAB-2016.E.C Page 13
INTRODUCTION TO COMMUNICATION (LAB- REPORT)
title('x1(n)+x2(n)');
% Signal Multiplication
xmult=x1.*x3;
subplot(2,3,6);
plot(xmult);
grid
title('x1*x3');

MATLAB-2016.E.C Page 14
INTRODUCTION TO COMMUNICATION (LAB- REPORT)
##@ Spectral Analyisis
Q) spectrum of*2+sin(2π*500t)+*cos(2π*2000)+
N=256;%Total Number of Samples
fs=8000; % Samples frequency set at 1000Hz
f=1000;
n=0:N-1;
% Now generate the sinusoidalsignal
x=sin(2*pi*(f/fs)*n);
% Estimate its spectrum using fft command
X=fft(x);
magX=abs(x);
% Build up an appropriate frequency axis
fx=0:(N/2)-1 %first make a vector for f=0,1,2,.....(N/2)-1
fx=(fx*fs)/N; %Now scale it so that it represents frequencies in Hz
figure(1);
subplot(1,1,1);
plot(fx,20*log10(magX(1:N/2)));
grid
title('Spectrum of a sinusoidal signal with f=1Khz');
xlabel('Frequency (Hz)');
ylabel('Magnitude(dB)');

MATLAB-2016.E.C Page 15
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

Experiment 3
Amplitude Modulation and Demodulation
Objective
After completion of this experiment you will be able to:
Generate AM signal in MATLAB.
Analyze an AM signal both in time and frequency domains.
Post Lab _Work;
Before we begin our AM simulation, we will define several parameters common to the rest of
this experiment.
We will use the following parameters in our simulations:
carrier frequency fc = 20 Hz
carrier amplitude Ac = 2 volt

MATLAB-2016.E.C Page 16
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

Sampling frequency fs = 2000 Hz


Signal Duration tend = 2 seconds
Sinusoidal Message Signal Amplitude = 1 volt
Sinusoidal Message Signal frequency = 4 Hz
Modulation Index Ka = 0.5
Let's generate our message and carrier signals and apply the modulation:
1. Generate a 4 Hz continuous time sinusoidal message signal, m(t) = sin (8nt) amplitude
modulated by a carrier of c(t) = 2 sin (40 rt). Use sufficient points and sampling interval of
0.0005 seconds
2. Write the time domain expression for the modulated signal by using the following equation:
We have created the data signal (message signal) m, the carrier signal c, and the modulated
signal y
3. Plot the message signal, carrier and modulated signal for the duration of 2 seconds. (Use the
commands subplot and plot in MATLAB and select an appropriate time interval for each plot).
4. The normalized magnitude spectra (or frequency spectrum) of a signal can be found using
the built-in fft and fftshift functions in MATLAB. Plot the magnitude spectra (spectrum) for the
carrier, the message signal and frequency-modulated signal, y(t).
5. Note the difference between the low-frequency data signal x and the high-frequency
modulated signal y. Note that in this case, the modulation index Ka is 0.5 and thus the
modulation index m < 1. Try for Ka = 0.75, 0.9, 1 and 1.4. Write your observation as you vary
the modulation index. Observe the change of the spectrum shape for various modulation
indices.
6. Observe the change in the modulated waveform by changing the frequency of the message
signal and the amplitude of the message signal.
% Amplitude modulation of sinusoidal message signals
Am = 1;
Ac = 2;
fc = 20;
fm = 4;
ka = 0.5;
tend = 2;
fs = 2000;

MATLAB-2016.E.C Page 17
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

t = 0:1/fs:tend;
c = Ac*cos(2*pi*fc*t); % Carrier
m = a*cos(2*pi*fm*t); % Sinusoidal message signal
y (t) = Ac [1+ka m(t)] cos 2nfct
y = Ac* (1 + ka*m). *cos(2* pi* fc*t); % AM of sinusoidal waveform
subplot(3,1,1);
plot(t,mt,'Color','Red')
ylabel('Amplitude');
title('Message signal');
axis ([-(max(t)-min(t))*0.0 max(t)*1.0 min(m)*1.1 max(m)* 1.1]); subplot(3,1,2);
plot(t,c,'Color', 'Green')
ylabel('Amplitude');
title('Carrier signal') ;
subplot(3,1,3);
plot(t,y);
ylabel('Amplitude') ;
title('AM Modulation of the message signal');
m_frequency = fitshift(ff(m)) *ts;
delta = fs/length(m _frequency);
f axis = -fs/2:delta:fs/2-delta;
subplot(3,1,1);
plot(f_axis, abs(m _frequency));
xlabel('Frequency in Hz');
ylabel(‘Magnitude');
title('Magnitude spectrum of the message signal');
c_frequency = fftshift(ff(c) )*ts;
delta = fs/length(c_frequency);
f axis = -fs/2:delta:fs/2-delta;
subplot(3,1,2);
plot(f_axis, abs(c frequency));
label('Frequency in Hz');
ylabel('Magnitude');
title('Magnitude spectrum of carrier signal')
y_ frequency = fftshift(fft(y))*ts;
delta = fs/length(y_frequency);
faxis = -fs/2:delta:fs/2-delta;
subplot(3,1,3);
plot(f axis, abs(y_frequency));
label('Frequency in Hz');
ylabel(‘Magnitude’);
title('Magnitude spectrum of the AM signal');

MATLAB-2016.E.C Page 18
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

Result

Conclusion
In conclusion, we have explored the concepts of amplitude modulation and demodulation using
MATLAB. We have learned that amplitude modulation is a technique used to transmit
information by varying the amplitude of a carrier signal. Demodulation is the process of
extracting the original information from the modulated signal.
We have used MATLAB to simulate these operations and observe their effects on signals. We
have seen that modulation can be used to transmit audio signals over long distances, while
demodulation can be used to recover the original audio signal from the modulated signal.
Furthermore, we have explored how MATLAB provides efficient and convenient tools for
performing amplitude modulation and demodulation operations. We have used built-in
functions such as ammod and amdemod to perform these operations on signals of different
frequencies and amplitudes.
Overall, the knowledge gained from this report will be useful in understanding the fundamental
principles of amplitude modulation and demodulation and their applications in various fields. It

MATLAB-2016.E.C Page 19
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

will also help in developing skills to use MATLAB efficiently for performing these operations on
signals.

Experiment 4
 Frequency Modulation (FM)
Experiment Objective:
The goals of this lab are the following:
Create an FM signal by modulating a sinusoidal and non-sinusoidal message onto a carrier,
 Observe FM signal in time domain,
 Examine frequency spectrum of frequency modulated signal,
 Evaluate frequency spectrum of the modulated signal when the modulation index
isvaried.
Lab Work:
In this experiment we will consider the modulation and demodulation of Frequency
Modulation. Frequency - modulated wave y_FM(t) can be described as function of time given
by:
Where kf= frequency sensitivity of the modulator in Hz/v
1. Given a 100Hz continuous time sinusoidal message signal, m(t) = 08 sin (200nt)
frequency modulated by a carrier of s(t) = 0.8 cos (2000 ). Using sufficient points and
sampling interval of 0.0001 seconds, plot the message and carrier signals for duration of
0.05 seconds. (Use the commands subplot and plot in MATLAB and select an
appropriate time interval for each plot).
2. Write the time domain expression for the modulated signal by using the following
equation:

×(t) = Ac cos[2 fc+ 2 kf ∫ ( ) ]

3. Find the result of ∫ ( ) by integrating the message signal, m(t). Assuming that the
frequency sensitivity, kf = 625 Hz/V, what is the modulation index for this signal? Plot
the modulated signal for the duration of 0.05 seconds.
4. You can also find the result of ∫ ( ) numerically in MATLAB by using cumsum(x)/Fs,
function where × and Fs are the message signal and sampling rate used, respectively.
Plot the modulated signal using the cumsum function for the duration of 0.05 seconds.
Compare the plots. Are they the same?

MATLAB-2016.E.C Page 20
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

5. The normalized magnitude spectra (or frequency spectrum) of a signal can be found
using the built-in fft and fftshift functions in MATLAB. Plot the magnitude spectra
(spectrum) for the carrier, the message signal and frequency-modulated signal, (t).
6. Frequency modulation can be categorized into either narrowband or wideband. When
the modulation index, B is very small, it is usually called narrowband FM (NBFM).
Generate the spectrum of the above frequency-modulated signal, x(t) when the
modulation index, B = 0.005, 0.1, 1, 10 and 50. Observe the change of the spectrum
shape for various modulation indices. What can you conclude when the modulation
index is very large?
Sample CODE
% Angle modulation of a sinusoidal message signal
fs = 10000;
ts = 1/fs;
tend = 0.05;
t = 0:ts:tend;
Am = 0.8;
Ac = 0.8;
fc = 1000;
fm = 100;
kp=25;
kf= 625;
c= Ac*sin(2*pi*fc*t); % Carrier
m = Am*sin(2* pi* fm*t); % Sinusoidal message signal
y_FM = Ac*cos(2*pi*fc*t + (kf*2*pi*cumsum(m) )*ts);
% FM of sinusoridal wavelom
y_PM= Ac*cos(2*pi*fc*t+ kp*m);
% PM of sinusoidal wavefom
%We have created the data signal (message signal) m, the carrier signal c, and the PM
modulated signal y_FM and the PM modulated signal y _PM.
%Let's try plotting the message signal and the modulated signal:
figure(1)
subplot(5,1,1);
plot(t,m, 'Color','Red')
xlabel('Time in seconds')
ylabel('Amplitude');
title('Sinusoidal Message signal')
axis ([-(max(t)-min(t))*0.0 max(t)*1.0 min(m)* 1.1 max(m)* 1.1]);
subplot(5,1,2);
plot(t,y_FM)
xlabel('Time in seconds')
ylabel('Amplitude')
title('FM Modulated signal of a sinusoidal message signal')
subplot(5,1,3);
MATLAB-2016.E.C Page 21
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

plot(t,y_PM)
xlabel('Time in seconds')
ylabel('Amplitude')
title ('PM Modulated signal of a sinusoidal message signal')
%let's see spectrum of the above FM modulated signal.
m_frequency =fftshift(fft(m))*ts;
delta=fs/length(m_frequency);
f_axis=-fs/2:delta:fs/2-delta;
subplot(5,1,4);
plot(f_axis,abs(m_frequency))
xlabel('Frequency in Hz')
ylabel('Magnitude')
title('Magnitude spectrum of the message signal')
y_frequency=fftshift(fft(y_FM))*ts;
delta = fs/length(y_frequency);
f_axis = -fs/2:delta:fs/2-delta;
subplot(5,1,5);
plot(f_axis,abs(y_frequency))
xlabel('Frequency in Hz')
ylabel('Magnitude')
title('Magnitude spectrum of the FM signal')
Result

MATLAB-2016.E.C Page 22
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

Conclusion
In conclusion, we have explored the concepts of frequency modulation and demodulation using
MATLAB. We have learned that frequency modulation is a technique used to transmit
information by varying the frequency of a carrier signal. Demodulation is the process of
extracting the original information from the modulated signal.
We have used MATLAB to simulate these operations and observe their effects on signals. We
have seen that modulation can be used to transmit audio signals over long distances with less
interference than amplitude modulation, while demodulation can be used to recover the
original audio signal from the modulated signal.
Fumoreover, we have explored how MATLAB provides efficient and convenient tools for
performing frequency modulation and demodulation operations. We have used built-in
functions such as fmmod and fmdemod to perform these operations on signals of different
frequencies and amplitudes.The knowledge gained from this report will be useful in

MATLAB-2016.E.C Page 23
INTRODUCTION TO COMMUNICATION (LAB- REPORT)

understanding the fundamental principles of frequency modulation and demodulation and


their applications in various fields. It will also help in developing skills to use MATLAB efficiently
for performing these operations on signals.

MATLAB-2016.E.C Page 24

You might also like