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

23bec1231 Acslab3

The document contains MATLAB code for generating and plotting a message signal, a carrier signal, and their frequency-modulated (FM) signal. It also includes the demodulation of the FM signal and plots the results. Key parameters include message frequency, amplitude, carrier frequency, and frequency deviation.

Uploaded by

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

23bec1231 Acslab3

The document contains MATLAB code for generating and plotting a message signal, a carrier signal, and their frequency-modulated (FM) signal. It also includes the demodulation of the FM signal and plots the results. Key parameters include message frequency, amplitude, carrier frequency, and frequency deviation.

Uploaded by

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

clc;

close all;
clear all;
fm = 20;% msg signal frequency in Hz
Am = 1; %amplitude of msg signal in volts
fs = 10000;% sampling frequency where fs must be at least 2*fc
nc = 3;%number of cycle of msg signal
t=0:1/fs:nc/fm;% time vector
%m=Am*sin(2*pi*fm*t);% msg signal generation
dcy = 2;%duty cycle: The duty cycle is the percent of the signal period in
which the square wave is positive.
m = Am*(square(2*pi*fm*t)+dcy);% if msg signal square wave
% ploting of msg signal
subplot(4,1,1);
plot(t,m,'LineWidth',2,'Color','r');
set(gca,'fontsize',11,'fontweight','bold');% gca for current axes
xlabel('Time', 'fontsize', 11, 'fontweight', 'bold');
ylabel('Frequency', 'fontsize', 11, 'fontweight', 'bold');
title('MessageSignal-23bec1231','fontsize',12);
fc = 100;% carrier signal frequency in Hz
Ac = 1;%amplitude of carrier signal in volts
c=Ac*sin(2*pi*fc*t);% carrier signal generation
% ploting of carrier signal
subplot(4,1,2);
plot(t,c,'LineWidth',2,'Color','b');
set(gca,'fontsize',11,'fontweight','bold');
xlabel('Time', 'fontsize', 11, 'fontweight', 'bold');
ylabel('Frequency', 'fontsize', 11, 'fontweight', 'bold');
title('Carrier Signal', 'fontsize', 12);
% generation of FM signal
mf = 50;%frequency deviation
s=fmmod(m,fc,fs,mf);% frequency modulation function y =
fmmod(m,fc,fs,freqdev, it will give FM modulated wave
% ploting of FM signal
subplot(4,1,3)
plot(t,s,'LineWidth',2,'Color','g');
set(gca,'fontsize',11,'fontweight','bold');
xlabel('Time', 'fontsize', 11, 'fontweight', 'bold');
ylabel('Frequency', 'fontsize', 11, 'fontweight', 'bold');
title('FM Signal', 'fontsize', 12);
%demodulation of FM signal

z=fmdemod(s,fc,fs,mf);% frequency demodulation function y =


fmdemod(s,fc,fs,freqdev), it will give FM demodulated wave
% ploting of demodulated FM signal
subplot(4,1,4)
plot(t,z,'LineWidth',2,'Color','g');
set(gca,'fontsize',11,'fontweight','bold');
xlabel('Time', 'fontsize', 11, 'fontweight', 'bold');
ylabel('Amplitude', 'fontsize', 11, 'fontweight', 'bold');
title('Demodulatedsignal','fontsize',12);

clc;
close all;
clear all;
fm = 20;% msg signal frequency in Hz
Am = 1; %amplitude of msg signal in volts
fs = 10000;% sampling frequency where fs must be at least 2*fc
nc = 3;%number of cycle of msg signal
t=0:1/fs:nc/fm;% time vector
%m=Am*sin(2*pi*fm*t);% msg signal generation
dcy = 2;%duty cycle: The duty cycle is the percent of the signal period in
which the square wave is positive.
m = Am*sin(2*pi*fm*t);% if msg signal square wave
% ploting of msg signal
subplot(4,1,1);
plot(t,m,'LineWidth',2,'Color','r');
set(gca,'fontsize',11,'fontweight','bold');% gca for current axes
xlabel('Time', 'fontsize', 11, 'fontweight', 'bold');
ylabel('Amplitude', 'fontsize', 11, 'fontweight', 'bold');
title('MessageSignal-23bec1231','fontsize',12);
fc = 100;% carrier signal frequency in Hz
Ac = 1;%amplitude of carrier signal in volts
c=Ac*sin(2*pi*fc*t);% carrier signal generation
% ploting of carrier signal
subplot(4,1,2);
plot(t,c,'LineWidth',2,'Color','b');
set(gca,'fontsize',11,'fontweight','bold');
xlabel('Time', 'fontsize', 11, 'fontweight', 'bold');
ylabel('Amplitude', 'fontsize', 11, 'fontweight', 'bold');
title('Carrier Signal', 'fontsize', 12);
% generation of FM signal
mf = 50;%frequency deviation
s=fmmod(m,fc,fs,mf);% frequency modulation function y =
fmmod(m,fc,fs,freqdev, it will give FM modulated wave
% ploting of FM signal
subplot(4,1,3)
plot(t,s,'LineWidth',2,'Color','g');
set(gca,'fontsize',11,'fontweight','bold');
xlabel('Time', 'fontsize', 11, 'fontweight', 'bold');
ylabel('Amplitude', 'fontsize', 11, 'fontweight', 'bold');
title('FM Signal', 'fontsize', 12);
%demodulation of FM signal

z=fmdemod(s,fc,fs,mf);% frequency demodulation function y =


fmdemod(s,fc,fs,freqdev), it will give FM demodulated wave
% ploting of demodulated FM signal
subplot(4,1,4)
plot(t,z,'LineWidth',2,'Color','g');
set(gca,'fontsize',11,'fontweight','bold');
xlabel('Time', 'fontsize', 11, 'fontweight', 'bold');
ylabel('Amplitude', 'fontsize', 11, 'fontweight', 'bold');
title('Demodulatedsignal','fontsize',12);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy