Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views16 pages

Analogcommunication

The document outlines a practical exercise for analog communication using MATLAB to analyze a message signal, carrier signal, and their amplitude modulated (AM) signal. It includes code snippets for generating and plotting these signals, as well as computing and plotting their frequency spectra using Fast Fourier Transform (FFT). The exercise demonstrates the relationship between time-domain signals and their frequency-domain representations.

Uploaded by

iamrahul8949
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)
5 views16 pages

Analogcommunication

The document outlines a practical exercise for analog communication using MATLAB to analyze a message signal, carrier signal, and their amplitude modulated (AM) signal. It includes code snippets for generating and plotting these signals, as well as computing and plotting their frequency spectra using Fast Fourier Transform (FFT). The exercise demonstrates the relationship between time-domain signals and their frequency-domain representations.

Uploaded by

iamrahul8949
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/ 16

Name : Rajendra Mewada

Roll No : 23t4052

Practical For Analog Communication

5. Using MATLAB, determine the spectra of the message signal m(t) and amplitude modulated signal (AM
with carrier and both side bands).
(1) Plot message signal m(t) which is a sinusoid signal of 8.34 Hz.
(2) Carrier signal is given as cos(2π*250*t). plot the carrier signal.
(3) Modulation index is given as m=0.63; plot the AM modulated signal.
Matlab CODE

Parameters
• f_m = 8.34; % Frequency of message signal (Hz)
• f_c = 250; % Frequency of carrier signal (Hz)
• m = 0.63; % Modulation index
• t = 0:1e-4:0.1; % Time vector (0.1 sec duration)
Message Signal
• m_t = sin(2*pi*f_m*t); % Message signal (sinusoid)

The code m_t = sin(2*pi*f_m*t); generates a sinusoidal message signal. :


•sin(...) creates a sine wave.
•2*pi*f_m*t is the argument for the sine function, where:
•f_m is the frequency of the wave (in Hz).
•t is time.
The result, m_t, is a sinusoidal signal that oscillates at the frequency f_m over time t.
Carrier Signal
• carrier_t = cos(2*pi*f_c*t); % Carrier signal

The code carrier_t = cos(2*pi*f_c*t); generates a cosine wave with frequency f_c (in Hz) as the carrier signal. It oscillates
over time t, and carrier_t stores the signal's value at each time point.
AM Modulation
• AM_signal = (1 + m * cos(2*pi*f_m*t)) .* cos(2*pi*f_c*t)

The code AM_signal = (1 + m * cos(2*pi*f_m*t)) .* cos(2*pi*f_c*t); generates an Amplitude


Modulated (AM) signal by varying the amplitude of the carrier cos(2*pi*f_c*t) with the message
signal cos(2*pi*f_m*t), controlled by the modulation index m.
Plot Message Signal
• subplot(3,1,1);
• plot(t, m_t);
• title('Message Signal m(t) (8.34 Hz)’);
• xlabel('Time (s)’);
• ylabel('Amplitude')

This code plots the message signal m_t in a subplot


.subplot(3,1,1): Creates a subplot grid with 3 rows and 1 column, and selects the first plot for the
message signal.
•plot(t, m_t): Plots m_t (message signal) versus time t.
•title('Message Signal m(t) (8.34 Hz)'): Adds a title to the plot, indicating the message signal's name
and frequency.
•xlabel('Time (s)'): Labels the x-axis as "Time (s)".
•ylabel('Amplitude'): Labels the y-axis as "Amplitude".
Plot Carrier Signal

• subplot(3,1,2);
• plot(t, carrier_t);
• title('Carrier Signal cos(2*pi*250*t)’);
• xlabel('Time (s)’);
• ylabel('Amplitude')

This code plots the carrier signal in a subplot. :


•subplot(3,1,2): Creates a subplot grid with 3 rows and 1 column, and selects the second
plot for the carrier signal.
•plot(t, carrier_t): Plots carrier_t (carrier signal) versus time t.
•title('Carrier Signal cos(2*pi*250*t)'): Adds a title to the plot, indicating the carrier
signal's mathematical expression with a frequency of 250 Hz.
•xlabel('Time (s)'): Labels the x-axis as "Time (s)".
•ylabel('Amplitude'): Labels the y-axis as "Amplitude".
.
Plot AM Signal

• subplot(3,1,3);
• plot(t, AM_signal);
• title('AM Modulated Signal’);
• xlabel('Time (s)’);
• ylabel('Amplitude')

This code plots the AM modulated signal in a subplot.


subplot(3,1,3): Creates a subplot grid with 3 rows and 1 column, and selects the third plot for the
AM signal.
•plot(t, AM_signal): Plots the AM modulated signal AM_signal versus time t.
•title('AM Modulated Signal'): Adds a title to the plot, indicating it's an AM modulated signal.
•xlabel('Time (s)'): Labels the x-axis as "Time (s)".
•ylabel('Amplitude'): Labels the y-axis as "Amplitude".
Compute FFT for Message Signal

• fft_m_t = abs(fft(m_t));
• f_m_t = linspace(0, 1/(2*mean(diff(t))), length(fft_m_t)/2)

This code computes the FFT of the message signal m_t to get its frequency components.
•fft_m_t = abs(fft(m_t)): Calculates the magnitude of the FFT of m_t.
•f_m_t = linspace(0, 1/(2*mean(diff(t))), length(fft_m_t)/2): Generates a frequency vector for
plotting the positive frequencies of the FFT.
It converts the message signal from the time domain to the frequency domain.
Plot Message Signal Spectrum

• figure; • subplot(3,1,1);
• plot(f_m_t, fft_m_t(1:length(f_m_t)));
• title('Message Signal Spectrum’);
• xlabel('Frequency (Hz)’);
• ylabel('Magnitude')

This code plots the message signal's frequency spectrum:


•figure;: Opens a new figure window.
•subplot(3,1,1);: Selects the first subplot in a 3-row grid.
•plot(f_m_t, fft_m_t(1:length(f_m_t))): Plots the magnitude of the FFT against frequency f_m_t.
•title, xlabel, ylabel: Adds the title "Message Signal Spectrum" and labels the axes ("Frequency
(Hz)" and "Magnitude").
It shows the frequency components of the message signal.
Compute FFT for Carrier Signal

• fft_carrier_t = abs(fft(carrier_t));
• f_carrier_t = linspace(0, 1/(2*mean(diff(t))), length(fft_carrier_t)/2)

This code computes the FFT of the carrier signal:


•fft_carrier_t = abs(fft(carrier_t));: Calculates the magnitude of the FFT of carrier_t.
•f_carrier_t = linspace(0, 1/(2*mean(diff(t))), length(fft_carrier_t)/2);: Creates a frequency vector
f_carrier_t for the positive frequencies.
It converts the carrier signal from the time domain to the frequency domain.
Plot Carrier Signal Spectrum

• subplot(3,1,2);
• plot(f_carrier_t, fft_carrier_t(1:length(f_carrier_t)));
• title('Carrier Signal Spectrum’);
• xlabel('Frequency (Hz)’);
• ylabel('Magnitude');

This code plots the carrier signal's frequency spectrum:


•subplot(3,1,2);: Selects the second subplot.
•plot(f_carrier_t, fft_carrier_t(1:length(f_carrier_t))): Plots the magnitude of the FFT of the
carrier signal against the frequency vector.
•title, xlabel, ylabel: Adds a title and labels for the x-axis ("Frequency (Hz)") and y-axis
("Magnitude").
It shows the frequency components of the carrier signal.
Compute FFT for AM Signal

• fft_AM_signal = abs(fft(AM_signal));
• f_AM_signal = linspace(0, 1/(2*mean(diff(t))), length(fft_AM_signal)/2);

This code computes the FFT of the AM signal:


•fft_AM_signal = abs(fft(AM_signal));: Calculates the magnitude of the FFT of AM_signal.
•f_AM_signal = linspace(0, 1/(2*mean(diff(t))), length(fft_AM_signal)/2);: Creates a frequency
vector for the positive frequencies of the FFT.
It transforms the AM signal into the frequency domain.
Plot AM Signal Spectrum

• subplot(3,1,3);
• plot(f_AM_signal, fft_AM_signal(1:length(f_AM_signal)));
• title('AM Modulated Signal Spectrum’);
• xlabel('Frequency (Hz)’);
• ylabel('Magnitude');

This code plots the AM signal's frequency spectrum:


•subplot(3,1,3);: Selects the third subplot.
•plot(f_AM_signal, fft_AM_signal(1:length(f_AM_signal))): Plots the magnitude of the FFT
of the AM signal against the frequency vector.
•title, xlabel, ylabel: Adds a title and labels for the x-axis ("Frequency (Hz)") and y-axis
("Magnitude").
It shows the frequency components of the AM signal.
OUTPUT

Figure 1
Figure 2

You might also like