Sunteți pe pagina 1din 4

NAME:P.

SAI MANOJ DATE:


ROLL NO:16H61A04A4 PAGE NO:

EXPERIMENT NO:9.

PULSE WIDTH MODULATION AND DEMODULATION.

AIM:

To perform the time pulse width modulation and demodulation using a message and carrier signals in MATLAB
software.

TOOLS REQUIRED:

SOFTWARE REQUIRED:MATLAB R2015a.

HARDWARE REQUIRED: Pesonal computer (pc).

THEORY:

Pulse Width Modulation (PWM) is a commonly used technique for generally controlling DC power to an electrical
device, made practical by modern electronic power switches. Pulse Width Modulation (PWM) is a fancy term for
describing a type of digital signal. Pulse width modulation is used in a variety of applications including
sophisticated control circuitry. A common way we use them here at SparkFun is to control dimming of RGB
LEDs or to control the direction of a servo motor. We can accomplish a range of results in both applications
because pulse width modulation allows us to vary how much time the signal is high in an analog fashion. While
the signal can only be high (usually 5V) or low (ground) at any time, we can change the proportion of time the
signal is high compared to when it is low over a consistent time interval.

SOURCE CODE:

clc; %clear command window.


clear all; %clear work space.
close all; %close all output windows.
fs=400; %sampling frequency.
t=0:1/fs:(0.1-(1/fs)); %time assignment.

ANURAG GROUP OF INSTITUTIONS ECE DEPARTMENT AC LAB


NAME:P.SAI MANOJ DATE:
ROLL NO:16H61A04A4 PAGE NO:

fm=10; %frequency of message signal.


fc=15; %frequency of carrier signal.
m=0.5*sin(2*pi*fm*t)+0.5; %message signal assignment.
subplot(2,2,1); %subplot in the function.
plot(t,m); %plotting the function.
xlabel('time'); %time assignment on x axis.
ylabel('amplitude'); %amplitude assignment on y axis.
title('message signal'); %displaying the title.
gtext('4a0') %displaying the roll number.
c=0.38*square(2*pi*fc*t)+0.5; %carier signal assignment.
subplot(2,2,2); %subplot in the function.
plot(t,c); %plotting the function.
xlabel('time'); %time assignment on x axis.
ylabel('amplitude'); %amplitude assignment on y axis.
title('message signal'); %displaying the title.
gtext('4a0') %displaying the roll number.
p=modulate(m,fc,fs,'pwm'); %modulating signal assignment.
subplot(2,2,3); %subplot in the function.
plot(p); %plotting the function.
xlabel('time'); %time assignment on x axis.
ylabel('amplitude'); %amplitude assignment on y axis.
title('modulated signal'); %displaying the title.
gtext('4a0') %displaying the roll number.
r=demod(p,fc,fs,'pwm'); %demodulating signal assignment.
subplot(2,2,4); %subplot in the function.
plot(r); %plotting the function.
xlabel('time'); %time assignment on x axis.
ylabel('amplitude'); %amplitude assignment on y axis.
title('modulated signal'); %displaying the title.

ANURAG GROUP OF INSTITUTIONS ECE DEPARTMENT AC LAB


NAME:P.SAI MANOJ DATE:
ROLL NO:16H61A04A4 PAGE NO:

gtext('4a0') %displaying the roll number.

PROCEDURE:

1.Open MATLAB.

2. Create new M-file.

3. Write the program.

4.Save the file in current directory.

5.Go to debug and compile your file.

6.View the output in command window or figure window.

APPLICATIONS:

 Sevos.
 Power delivery.
 Telecommunications.
 Volatage regulation.
RESULT:

Pulse width modulation and demodulation is done by using a message signal and carrier signal in MATLAB softwa

ANURAG GROUP OF INSTITUTIONS ECE DEPARTMENT AC LAB


NAME:P.SAI MANOJ DATE:
ROLL NO:16H61A04A4 PAGE NO:

OUTPUT:

4a0
4a0
message signal carrier signal
1 1
amplitude

amplitude
0.5 0.5

4a0
0 0
0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1
time 4a0 time
modulated signal demodulated signal
1 2
amplitude

amplitude
0.5 1

0 0
0 100 200 300 400 500 600 0 5 10 15 20 25 30 35 40
time time

ANURAG GROUP OF INSTITUTIONS ECE DEPARTMENT AC LAB

S-ar putea să vă placă și