CE file
CE file
Date of
S. No. Conten Page no. Signature
Experiment
t
EXPERIMENT – 1
THEORY: MATLAB stands for "MATrix LABoratory", which reflects its origins as a tool for matrix operations and linear
algebra. However, it has evolved into a much more powerful tool that supports a wide range of numerical and
computational tasks. It allows users to perform various computational tasks such as data analysis, signal processing, and
image and video processing. MATLAB also provides a variety of toolboxes that extend its capabilities for specific
application domains, such as control systems, statistics, and optimization.
MATLAB's programming language is designed to be easy to learn and use, and it supports a variety of programming
paradigms, including procedural, object-oriented, and functional programming. It also has a rich set of built-in functions
and commands, which can be used to perform common tasks and operations.
MATLAB's interactive environment allows users to enter commands and see immediate results, which makes it useful
for exploratory work and rapid prototyping. It also supports the creation of custom graphical user interfaces (GUIs) and
the development of standalone applications.
Overall, MATLAB is a powerful and versatile tool that has become an indispensable part of many scientific and
engineering workflows.
WINDOWS:
1. COMMAND WINDOW
The command window in MATLAB is a powerful
interactive interface that allows you to execute
commands, display and analyze data, and interact with
the MATLAB environment. It is the main window in
MATLAB, and it appears by default when you start
MATLAB.
You can use the command window to enter and execute
commands in MATLAB. This makes it a powerful tool for
exploring data, performing calculations, and testing code.
For example, you can use the command window to
create variables, define functions, load data from files,
and generate plots. The results of executed commands
are displayed in the command window, including any
error messages that may occur.
In addition to executing commands, the command
window also provides a number of other features that
make it a powerful tool for working with MATLAB. For example, the command history is stored in the command
window, allowing you to recall and execute previously executed commands. The command window also supports
command-line editing, which makes it easy to correct mistakes and modify previous commands. Another useful feature
of the command window is the ability to save commands and output to a file.
Overall, the command window in MATLAB is a powerful and flexible tool that is essential for working with MATLAB. It
allows you to interact with the MATLAB environment in a flexible and efficient manner, making it easier to perform data
analysis, modelling, and simulation tasks.
2. EDITOR WINDOW
3. FIGURE WINDOW
The Figure window in MATLAB is a graphical window that
is used to display plots, graphs, and other visualizations.
It is the primary output mechanism for creating
visualizations in MATLAB.
You can create a Figure window using the "figure"
command in MATLAB. Once you have created a Figure
window, you can use MATLAB commands to create and
modify visualizations. This might include commands to
plot data, create bar charts, or generate scatter plots.
The Figure window can display multiple plots
simultaneously, each in its own axis or subplot.
The Figure window provides many customization options
to modify the appearance of visualizations. For example,
you can change the colours and styles of lines, add labels and titles to the plot, and adjust the size and layout of the plot.
You can also add other graphical elements, such as text annotations, arrows, and shapes.
In addition to modifying the appearance of visualizations, the Figure window provides interactive tools to explore and
analyze data. For example, you can use the data cursor tool to view the values of individual data points, or use the
zoom and pan tools to focus on specific parts of a plot.
The Figure window also supports saving plots in a variety of formats, including JPEG, PNG, PDF, and MATLAB figure files.
This allows you to share your visualizations with others or to include them in reports or presentations.
Overall, the Figure window in MATLAB is a powerful and flexible tool for creating visualizations of data. It provides a
wide range of customization and interactive options that allow you to create professional-quality plots and graphs, and
is an essential tool for anyone working with data in MATLAB.
COMMANDS:
There are several types of commands that you can give in MATLAB.
The most common types of commands include:
2) Arithmetic commands: Used to perform mathematical operations on variables or values. For example, x + y or
sin(x).
3) Control flow commands: Used to control the flow of execution in a program. This includes commands like "if",
"for", "while", and "switch".
4) Input/output commands: Used to read or write data to and from files, or to interact with the user. For example,
input() or fprintf().
5) Graphics commands: Used to create plots and visualizations. This includes commands like plot(), scatter(), and
imshow().
6) Function commands: Used to create user-defined functions that can be called from other parts of a program.
For example, function [y] = myfunction(x).
7) System commands: Used to interact with the operating system, such as running external programs or accessing
system variables. This includes commands like system() or getenv().
These are just some of the most common types of commands that you can use in MATLAB. Depending on your specific
use case, there may be other types of commands that you need to use as well.
PLOTS:
MATLAB provides a wide variety of plot types for creating visualizations of data. Here are some of the most common
types of plots in MATLAB:
1. Line plots: These plots show data as a series of points connected by lines. The plot function is used to create line
plots in MATLAB.
2. Scatter plots: These plots show data as a collection of points, with each point representing a single observation.
The scatter function is used to create scatter plots in MATLAB.
3. Bar plots: These plots show data as bars of different heights, with each bar representing a category or group.
The bar function is used to create bar plots in MATLAB.
4. Histograms: These plots show the distribution of a set of values by grouping them into bins and counting the
number of values in each bin. The histogram function is used to create histograms in MATLAB.
5. Pie charts: These plots show the relative proportions of different categories in a dataset as wedges of a pie. The
pie function is used to create pie charts in MATLAB.
6. Heatmaps: These plots show the intensity of data values as a color map, with each color representing a
different range of values. The heatmap function is used to create heatmaps in MATLAB.
7. Contour plots: These plots show the contours of a function of two variables, with each contour representing a
particular level of the function. The contour function is used to create contour plots in MATLAB.
These are just a few examples of the types of plots that can be created in MATLAB. Depending on your specific needs,
there may be other plot types or variations of these plot types that you can use as well.
EXPERIMENT – 2
Signals can be of various types, including analog and digital signals. Analog signals are continuous-time signals that vary
continuously over time, while digital signals are discrete-time signals that take on only specific values at specific points
in time. Signals can also be periodic or non-periodic, deterministic or stochastic, and can be represented in various
forms such as sine waves, square waves, pulses, and more.
In communication systems, signals are often modified or processed to improve their quality or to extract information
from them. This can involve operations such as filtering, modulation, demodulation, and encoding/decoding. The choice
of signal processing techniques depends on the specific communication system and the nature of the signals being
transmitted.
SIGNALS:
1. SINE WAVE
A sine wave is a mathematical function that describes a smooth, repetitive oscillation. It has a shape that
resembles a wave, with peaks and valleys that repeat over a period of time. The mathematical equation for a
sine wave is y(t) = A sin(2πft + φ), where A is the amplitude of the wave, f is the frequency, t is time, and φ is
the phase shift.
CODE:
t = 0:0.01:2*pi;
% time values (from 0 to 2*pi, in steps of 0.01)
2. COSINE WAVE
A cosine wave is similar to a sine wave, but is shifted in phase by 90 degrees (or π/2 radians) relative to the sine
wave. The mathematical equation for a cosine wave is y(t) = A cos(2πft + φ).
CODE:
t = 0:0.01:2*pi; % time values (from 0 to 2*pi, in steps of 0.01)
y = 2*cos(2*t); % cosine wave values
CODE:
t = 0:0.01:5; % Generate time vector
A = 1; % Calculate exponential
wave
tau = 0.5;
y = A * exp(-t/tau);
CODE:
n = 0:9; % Generate unit signal
x = [zeros(1,4),1,zeros(1,5)];
CODE:
n = -10:10; % Define the range of values for
signal u = n >= 0; % Generate the unit step
signal stem(n,u); % Plot the signal using the
stem function xlabel('n');
ylabel('u[n]');
title('Unit Step
Signal');
6. RAMP WAVE
In signal processing, a ramp signal is a type of signal that has linearly increasing or decreasing amplitude over
time. It is also known as a slope or linear signal. Mathematically, a ramp signal can be defined as:
ramp(t) = at + b
where a is the slope or rate of change of the signal, and b is the initial value of the signal at t = 0.
A ramp signal with a positive slope increases in amplitude over time, while a ramp signal with a negative slope
decreases in amplitude over time. The slope of the ramp signal determines the rate at which the amplitude
changes.
CODE:
t = 0:0.1:10; % Generate time vector
7. SINC WAVE
The sinc waveform is a periodic function that has a main lobe centered at x = 0 and smaller side lobes on either
side of the main lobe. The amplitude of the sinc waveform is highest at x = 0 and decreases as x moves away
from zero. The width of the main lobe and the amplitude of the side lobes depend on the length of the
waveform and the sampling rate used to generate it.
Formula for sinc signal is: sinc(x) = sin(x) / x
CODE:
clc
clear all
close all
t=-5:0.001:5;
w=-4*pi:0.01:4 pi;
for i=1:length (w)
xcw(i)=trapz (t, xct. *exp(-li*w(i).*t)); %fourier transform
end
plot(w, abs (xcw));
xlabel('w');
ylabel('absolute of sinc waveform');
grid on;
RESULT:
Basic signals used in signal processing such as sine, cosine, exp. signals were plotted on MATLAB.
EXPERIMENT – 3
AIM: To generate an Amplitude Modulated Signal using high frequency carrier signal.
To generate an AM signal, a high-frequency carrier wave is generated and then mixed with the audio signal to
be transmitted. This modulation process causes the amplitude of the carrier wave to vary in proportion to the
amplitude of the input signal. The modulated carrier wave is then transmitted through the medium, such as
air or a wire, to a receiver, where it is demodulated to recover the original audio signal.
AM modulation is widely used in broadcasting and communication systems, such as AM radio broadcasting,
where the carrier wave is in the range of hundreds of kilohertz, and the audio signal is in the range of a few
kilohertz. The modulation index, which is the ratio of the amplitude of the modulating signal to the amplitude
of the carrier wave, determines the level of modulation and the quality of the transmitted signal.
CODE:
clc;
disp('example m=1 means 100%
modulation'); m=0.7;
am=2;
fm=2000
;
tm=1/fm;
t=0:tm/999:6*tm;
ym=am*sin(2*pi*fm*t
); subplot(3,1,1);
plot(t,ym), grid
on;
title('Modulating
signal');
xlabel('time(sec)');
ylabel('amplitude(volt)'
); ac=am/m;
fc=fm*10
;
tc=1/fc;
yc=ac*sin(2*pi*fc*t);
subplot(3,1,2);
plot(t,yc,'g'), grid
on; title('Carrier
signal');
xlabel('time(sec)');
ylabel('amplitude(volt)
');
y=ac*(1+m*sin(2*pi*fm*t)).*sin(2*pi*fc
*t); subplot(3,1,3);
plot(t,y,'r'
); grid on;
title('Amplitude Modulated
signal'); xlabel('time(sec)');
ylabel('amplitude(volt)');
RESULT:
Thus, an Amplitude Modulated Signal is generated using high frequency carrier signal.
EXPERIMENT – 4
AIM: To generate an Amplitude Modulated Signal using high frequency carrier signal and further
demodulating the message signal out of it.
THEORY: Amplitude demodulation is the reverse process of modulation. Demodulation or enveloping is used
to recover the signal or to detect the message coded on the carrier signal. It filters out the carrier to
determine the original signal amplitude.
CODE:
clc
t=0:0.001:1
;
fc=50
;
fm=5;
am=1;
ac=3;
m=am*sin(2*pi*fm*t
);
c=ac*sin(2*pi*fc*t
); s=(1+m).*c;
hil=hilbert(s);
envelope=abs(hil
);
figure;
subplot(3,1,1
);
plot(t,m,'g');
title('Message
signal'); xlabel('Time
(s)');
ylabel('Amplitude');
subplot(3,1,2);
plot(t,c,'r');
title('Carrier
signal'); xlabel('Time
(s)');
ylabel('Amplitude');
subplot(3,1,3);
plot(t,envelope,'b'
); title('AM
Envelope');
xlabel('Time (s)');
ylabel('Amplitude')
;
RESULT:
Thus, an Amplitude Modulated Signal is generated using high frequency carrier signal and after demodulation,
we recovered our message signal which was now stored in the envelope of the amplitude modulated signal.
EXPERIMENT – 5
THEORY: DSBSC stands for Double Sideband Suppressed Carrier and refers to a type of amplitude modulation
(AM) technique where both the upper and lower sidebands of the modulated signal are transmitted, but the
carrier signal is suppressed or removed.
In DSBSC modulation, the modulating signal is multiplied by the carrier signal to produce two sidebands, each
containing a copy of the modulating signal, with frequencies shifted up and down by the carrier frequency.
The carrier signal is then removed or suppressed, leaving only the sidebands to be transmitted.
DSBSC modulation requires less power and bandwidth than conventional AM because the carrier signal, which
carries no information, is removed.
CODE:
clc
fs=1000
;
ts=1/fs;
t=0:ts:10
; am=2;
fm=1;
ac=2;
fc=10;
mt=am*cos(2*pi*fm*t
);
ct=ac*cos(2*pi*fc*t
); st=mt.*ct;
subplot(3,1,1);
plot(t,mt);
title('Modulating
signal'); xlabel('Time
(s)');
ylabel('Amplitude');
subplot(3,1,2);
plot(t,ct,'g');
title('Carrier
signal'); xlabel('Time
(s)');
ylabel('Amplitude');
subplot(3,1,3);
plot(t,st,'r');
title('DSBSC
signal');
xlabel('Time (s)');
ylabel('Amplitude');
RESULT:
AIM: To generate a DSB-SC Signal using high frequency carrier signal and further demodulating the message
signal out of it.
THEORY: For DSBSC, Coherent Demodulation is done by multiplying the DSB-SC signal with the carrier
signal (with the same phase as in the modulation process) just like the modulation process. This resultant
signal is then passed through a low pass filter to produce a scaled version of the original message signal.
CODE:
clc
fs=1000
;
ts=1/fs;
t=0:ts:10
; am=2;
fm=1;
ac=2;
fc=10;
mt=am*cos(2*pi*fm*t
);
ct=ac*cos(2*pi*fc*t
); st=mt.*ct;
wx=st.*ct;
jk='low';
[kj,mn]=butter(1,0.003,j
k);
yz=filtfilt(kj,mn,wx);
subplot(4,1,1);
plot(t,mt), grid on;
title('Message signal');
subplot(4,1,2);
plot(t,ct,'g'), grid
on; title('Carrier
signal');
subplot(4,1,3);
plot(t,st,'r'), grid
on; title('DSB
signal');
subplot(4,1,4);
plot(t,yz,'c'), grid on;
title('Demodulated
signal');
RESULT:
Thus, a DSB-SC Signal is generated using high frequency carrier signal and after demodulation, we recovered
our message signal in the demodulated signal which is nothing but a scaled version of the original message signal.
EXPERIMENT – 7
THEORY: SSBSC stands for Single Sideband Suppressed Carrier signal. It is a type of modulation technique used in
communication systems to transmit information over a radio frequency carrier wave.
In SSBSC modulation, the carrier signal is suppressed, and only one of the sidebands (either the upper or lower
sideband) is transmitted. This reduces the bandwidth required to transmit the signal and improves the power efficiency
of the transmission.
SSBSC modulation is commonly used in radio communication systems, particularly in voice communication, where it
helps to reduce the noise and interference that can affect the transmission. It is also used in some radar systems and
other applications where high-frequency signals need to be transmitted over long distances.
One potential disadvantage of SSBSC modulation is that it requires more complex modulation and demodulation
circuitry than other types of modulation techniques, which can increase the cost and complexity of the communication
system.
CODE:
clc;
clear;
close
all;
n=1024;
fs=2048;
ts=1/fs;
t=(0:n-1)/f
s; fc=50;
fm1=10;
em1=1;
m=em1*cos(2*pi*fm1*t
);
mh=em1*cos((2*pi*fm1*t)-pi/2);
sbu=m.*2.*cos(2*pi*fc*t)-
mh.*2.*sin(2*pi*fc*t);
sbl=m.*2.*cos(2*pi*fc*t)
+mh.*2.*sin(2*pi*fc*t);
SBU=2/n*abs(fft(sbu));
SBL=2/n*abs(fft(sbl));
freq=fs*(0:n/2)/n;
subplot(4,1,1)
plot(10*t,sbu,'r');
title('Upper
SideBand');
subplot(4,1,2)
plot(10*t,sbl,'b');
title('Lower
SideBand');
subplot(4,1,3)
plot(freq,
sbu(1:n/2+1));
subplot(4,1,4)
plot(freq,
sbl(1:n/2+1));
RESULT:
AIM: To generate a SSB-SC Signal using high frequency carrier signal and further demodulating the message
signal out of it.
THEORY: The demodulation of an SSBSC signal involves recovering the original baseband signal that was modulated
onto the carrier wave. Demodulation is the process of extracting the original information from the modulated signal.
The demodulation of an SSBSC signal can be done using either an envelope detector or a product detector.
Once the baseband signal has been recovered, it can be processed further for decoding and further processing.
CODE:
clc;
clear
all;
close
all;
n=1024;
fs=2048;
ts=1/fs;
t=(0:n-1)/f
s; fc=600;
fm1=20;
em1=1;
m=em1*cos(2*pi*fm1*t
);
mh=em1*cos((2*pi*fm1*t)-pi/2);
sbu=m.*2.*cos(2*pi*fc*t)-
mh.*2.*sin(2*pi*fc*t);
sbl=m.*2.*cos(2*pi*fc*t)
+mh.*2.*sin(2*pi*fc*t);
SBU=2/n*abs(fft(sbu));
SBL=2/
n*abs(fft(sbl));
freq=fs*(0:n/2)/n;
md=sbu.*cos(2*pi*fc*t
);
[b,a]=butter(2,0.1);
mf=filter(b,a,md);
subplot(6,1,1)
plot(10*t,sbu,'r');
subplot(6,1,2)
plot(10*t,sbl,'b');
subplot(6,1,3)
plot(freq,
sbu(1:n/2+1));
subplot(6,1,4)
plot(freq,
sbl(1:n/2+1));
subplot(6,1,5)
plot(t,mf)
subplot(6,1,6)
plot(freq,
mf(1:n/2+1));
RESULT:
Thus, a SSB-SC Signal is generated using high frequency carrier signal and after demodulation, we recovered
our message signal.
EXPERIMENT – 9
THEORY: Frequency Modulation (FM) is a modulation technique used in communication systems to transmit
information over a carrier wave by varying its frequency. In FM, the amplitude of the carrier wave remains constant
while its frequency is varied in proportion to the amplitude of the modulating signal.
The modulating signal can be an audio signal, such as a voice or music signal, or a digital signal. As the amplitude of the
modulating signal varies, the frequency of the carrier wave also varies, resulting in a modulated signal that carries the
information contained in the modulating signal.
The degree of frequency variation or deviation of the carrier wave is proportional to the amplitude of the modulating
signal. The amount of deviation is determined by a parameter called the modulation index, which is the ratio of the
maximum frequency deviation to the frequency of the modulating signal.
FM has several advantages over other modulation techniques, including a higher signal-to-noise ratio and immunity to
amplitude noise and interference. It is commonly used in radio and television broadcasting, two-way radio
communication, and other applications where high-quality audio or data transmission is required.
CODE:
clc;
close
all;
clear;
fs=1000;
ts=1/fs;
t=0:ts:10
; am=3;
fm=1;
ac=5;
fc=10;
kf=2;
mt=am*cos(2*pi*fm*t);
je=am/(2*pi*fm)*sin(2*pi*fm*t
); ct=ac*cos(2*pi*fc*t);
st=ac*cos(2*pi*fc*t+2*pi*kf*j
e); subplot(3,1,1);
plot(t,mt);
title('msg
signal');
xlabel('time(sec)'
);
ylabel('amplitude(volt)
'); subplot(3,1,2);
plot(t,ct,'g');
title('carrier');
xlabel('time(sec)');
ylabel('amplitude(volt)
'); subplot(3,1,3);
plot(t,st,'r');
title('FM
signal');
xlabel('time(sec)'
);
ylabel('amplitude(volt)');
RESULT:
AIM: To generate a FM Signal using high frequency carrier signal and further demodulating the message signal
out of it.
THEORY:
Frequency demodulation is the inverse of frequency modulation. The original modulating signal is obtained as output
following demodulation. After the signal has been received, filtered, and amplified, the original modulation from the
carrier must be recovered. This is known as demodulation or detection.
A simple and effective FM demodulation technique involves a high-pass filter (for FM-to-AM conversion) followed by an
AM demodulator. A high-pass-filter-based FM demodulator is preceded by a limiter to prevent amplitude variations
from contributing error to the demodulated signal.
CODE:
clc;
close
all;
clear;
fs=1000;
ts=1/fs;
t=0:ts:10
; am=3;
fm=1;
ac=5;
fc=10;
kf=2;
mt=am*cos(2*pi*fm*t);
je=am/(2*pi*fm)*sin(2*pi*fm*t
); ct=ac*cos(2*pi*fc*t);
st=ac*cos(2*pi*fc*t+2*pi*kf*j
e);
uv=-ac*2*pi*(fc+kf*mt).*sin(2*pi*fc*t+2*pi*kf*je);
wx=ac*2*pi*(fc+kf*mt);
jk='bandpass';
[kj,mn]=butter(1,
[.001,.003],jk);
yz=filtfilt(kj,mn,wx);
subplot(6,1,1);
plot(t,mt);
title('msg
signal');
subplot(6,1,2);
plot(t,ct,'g');
title('carrier'
);
subplot(6,1,3);
plot(t,st,'r');
title('FM
signal');
subplot(6,1,4);
plot(t,yz,'c');
title('demodulated
signal'); grid on;
RESULT:
Thus, a FM Signal is generated using high frequency carrier signal and after demodulation, we recovered our
message signal in the demodulated signal which is nothing but a scaled version of the original message signal.