0% found this document useful (0 votes)
10 views9 pages

CSP 2

Uploaded by

sriya bonkuri
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)
10 views9 pages

CSP 2

Uploaded by

sriya bonkuri
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/ 9

Name: B.

Sriya
Roll no:EC22B1101
Date:22-01-2025

Aim: 1. To explore FM modulation and demodulation of a sinusoidal message signal


using built-in functions (fmmod and fmdemod) and check if the process works as
expected.
2.To manually simulate the FM waveform, figure out the bandwidth using Carson’s Rule,
and better understand how FM modulation works.
3.To manually recover the original message signal from the FM-modulated signal,
compare it with the original, and see how well the demodulation process performs.

Theory:
1. FM Modulation Using Built-in Functions:
FM modulation is achieved by varying the carrier wave's frequency according to
the amplitude of the message signal. Built-in functions like fmmod (for
modulation) and fmdemod (for demodulation) simplify the process by
automating the calculations and providing efficient implementations. These
functions enable quick simulation and validation of FM signal generation and
recovery.
2. FM Modulation Without Built-in Functions:
Manually implementing FM modulation involves directly altering the
instantaneous frequency of the carrier signal. The modulated signal is expressed
as:
s(t)=Ac⋅cos(2πfct+βsin(2πfmt))

• Ac: Carrier amplitude


• fc: Carrier frequency
• fm: Message frequency
where β=Δf/fm is the modulation index, indicating the extent of frequency deviation Δf
relative to the message frequency fm. The bandwidth of the FM signal is estimated using
Carson's Rule:
Bandwidth (BW)=2⋅(Δf+fm)
This calculation highlights how the modulation parameters influence the signal's
spectrum.
3. FM Demodulation Without Built-in Functions:
FM demodulation retrieves the original message signal from the modulated
signal. Unlike built-in functions, manual demodulation techniques involve signal
processing methods, such as:
• Frequency Discrimination: The FM signal is differentiated to convert frequency
variations into amplitude changes, followed by envelope detection.
• Phase-Locked Loop (PLL): The PLL locks onto the FM signal's phase and extracts
the frequency variations as the original message.
The recovered signal is then compared with the original to verify the performance of the
demodulation technique and assess any distortions or inaccuracies.
This approach provides a deeper understanding of the FM demodulation process.

Codes:
1. fs=10000;
t=0:1/fs:1;
fm=50;
fc=100;
kf=50;
message = sin(2* pi* fm * t);
carrier= cos(2* pi* fc *t);
modulated_signal =fmmod(message ,fc,fs,kf);
demodulated_signal = fmdemod(modulated_signal, fc, fs, kf);
figure;
subplot(4,1,1)
plot(t,message,'R')
title("message signal")
xlabel("time(s)")
ylabel("amplitude")
subplot(4,1,2)
plot(t,carrier)
title("carrier signal")
xlabel("time(s)")
ylabel("amplitude")
subplot(4,1,3)
plot(t,modulated_signal)
title("modulated signal ")
xlabel("time(s)")
ylabel("amplitude")
subplot(4,1,4)
plot(t,demodulated_signal)
title("demodulated signal ")
xlabel("time(s)")
ylabel("amplitude")

2. A_c = 1;
f_c = 1000;
f_m = 100;
delta_f = 200;
sampling_rate = 100000;
duration = 0.02;
beta = delta_f / f_m;
time_steps = 0:1/sampling_rate:duration;
m_t = sin(2 * pi * f_m * time_steps);
s_t = A_c * cos(2 * pi * f_c * time_steps + beta * sin(2 * pi * f_m * time_steps));
BW = 2 * (delta_f + f_m);
figure;
subplot(2, 1, 1);
plot(time_steps, m_t, 'b');
title('Message Signal (m(t))');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(2, 1, 2);
plot(time_steps, s_t, 'r');
title('Frequency Modulated Signal (s(t))');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
disp(['Calculated Bandwidth using Carson''s Rule: ', num2str(BW), ' Hz']);
3.
fs = 5000; % Sampling frequency (Hz)
fc = 500; % Carrier frequency (Hz)
fmsg = 50; % Message signal frequency (Hz)
Am = 1; % Amplitude of message signal
kf = 100; % Frequency sensitivity (Hz/V)
duration = 0.05; % Duration of the signal (s)
t = 0:1/fs:duration;
msg = Am * sin(2 * pi * fmsg * t);
carrier = cos(2 * pi * fc * t);
int_msg = cumsum(msg) * (1/fs); % Integral of the message signal
fm_signal = cos(2 * pi * fc * t + 2 * pi * kf * int_msg); % FM signal
diff_fm_signal = [0, diff(fm_signal)] * fs; % Approximate time derivative
inst_phase = atan2(imag(hilbert(fm_signal)), fm_signal);
unwrapped_phase = unwrap(inst_phase);
inst_freq = [0, diff(unwrapped_phase)] * fs / (2 * pi);
demod_signal = (inst_freq - fc) / kf;
msg_spectrum = abs(fftshift(fft(msg)));
carrier_spectrum = abs(fftshift(fft(carrier)));
fm_signal_spectrum = abs(fftshift(fft(fm_signal)));
demod_signal_spectrum = abs(fftshift(fft(demod_signal)));
f = linspace(-fs/2, fs/2, length(t)); % Frequency vector for plotting
figure;
subplot(5, 2, 1);
plot(t, msg);
title('Message Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(5, 2, 2);
plot(f, msg_spectrum);
title('Message Signal Spectrum');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
grid on;
subplot(5, 2, 3);
plot(t, carrier);
title('Carrier Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(5, 2, 4);
plot(f, carrier_spectrum);
title('Carrier Signal Spectrum');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
grid on;
subplot(5, 2, 5);
plot(t, fm_signal);
title('FM Modulated Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(5, 2, 6);
plot(f, fm_signal_spectrum);
title('FM Modulated Signal Spectrum');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
grid on;
subplot(5, 2, 7);
plot(t, demod_signal);
title('Demodulated Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
subplot(5, 2, 8);
plot(f, demod_signal_spectrum);
title('Demodulated Signal Spectrum');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
grid on;
subplot(5, 2, 9);
plot(t, msg, 'b', 'DisplayName', 'Original Signal');
hold on;
plot(t, demod_signal, 'g--', 'DisplayName', 'Demodulated Signal');
title('Comparison of Original and Demodulated Signals');
xlabel('Time (s)');
ylabel('Amplitude');
legend;
grid on;

Inference:
1. FM Modulation Using Built-in Functions:
Using built-in functions like fmmod and fmdemod makes FM modulation and
demodulation quick and easy, saving time on complex calculations. They help us
confirm how the FM signal behaves without getting into the details of manual
computation.
2. FM Modulation Without Built-in Functions:
By manually working through FM modulation, we get a better understanding of
how the carrier’s frequency changes based on the message signal. With
calculations like the modulation index and Carson’s Rule, we can see how the
frequency deviation and message frequency impact the bandwidth.
3. FM Demodulation Without Built-in Functions:
When we demodulate FM signals manually, using methods like differentiation we
gain a deeper understanding of how the original message is recovered.
Comparing the demodulated signal with the original shows how well the
technique works and helps identify issues like noise or phase errors.

Result:
Using the built-in functions like fmmod and fmdemod, we were able to quickly and
accurately simulate FM modulation and demodulation. These tools made it easy to see
how the carrier frequency changes with the message signal, giving us a good idea of how
FM works without getting bogged down in complicated calculations.
When we manually worked through FM modulation and demodulation, we gained a
better understanding of the process. We could see firsthand how the frequency
deviation and message frequency influence the bandwidth, as shown by Carson's Rule.
By using methods like differentiation we successfully recovered the message signal.
However, we did notice some minor distortions, which highlighted the real-world
challenges of FM communication and demodulation. This experience gave us a much
clearer picture of how FM works in practice.

You might also like