0% found this document useful (0 votes)
235 views4 pages

Experiment No.2: Aim: To Generate PWM Waves Using MATLAB Theory

This document describes an experiment in MATLAB to generate PWM waves. It discusses the theory behind PWM where the width of an input signal is controlled before powering an electronic device. The MATLAB code generates a sinusoidal wave as the message signal and sawtooth wave as the carrier signal. It uses an if/else statement to compare the two signals and output a PWM wave with a duty cycle that varies based on the message signal. The learning outcome is that PWM can be used to convert analog signals to pulse trains and has applications in switching circuits and controlling power to devices like motors.

Uploaded by

DikshitJain
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)
235 views4 pages

Experiment No.2: Aim: To Generate PWM Waves Using MATLAB Theory

This document describes an experiment in MATLAB to generate PWM waves. It discusses the theory behind PWM where the width of an input signal is controlled before powering an electronic device. The MATLAB code generates a sinusoidal wave as the message signal and sawtooth wave as the carrier signal. It uses an if/else statement to compare the two signals and output a PWM wave with a duty cycle that varies based on the message signal. The learning outcome is that PWM can be used to convert analog signals to pulse trains and has applications in switching circuits and controlling power to devices like motors.

Uploaded by

DikshitJain
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/ 4

1

EXPERIMENT NO.2
Aim: To generate PWM waves using MATLAB.
Theory: General concept:PWM or Pulse width Modulation is used in the electronics majorly to control the voltage
at the input of the electronic device .
We control the width of the input signal before powering the electronic equipment
Advantages:It works as if a switch is connected to the input signal and the output of the switch
connects the electronic equipment to the switch .
We continuously turn the switch ON and OFF so as to control the effective time the
input goes to the output .
Disadvantages:Again in the whole time period of the input wave if we dont continuously do it then we
would generate an effect that would show discontinuous ON and OFF periods which is
not the idea behind PWM .We need a continuous effect so the switching is really fast
and is not perceptible to human.
Miscellaneous:The following equation is important:
Duty cycle =(Ton)/(Ton+Toff)
Duty cycle the percentage of on Time period to the Total Time Period.

MATLAB CODE:

clear all;
t=1:200;
m=sin(4*pi*t/200);
t=0:0.1:200;
s=2.*sawtooth(2*pi*t);
for t=1:200
if (m(t)>=s(t))
p(t)=1;
elseif (m(t)<=s(t))
p(t)=0;
end
end
t =1:200;
subplot(3,1,1);
plot(t,m(t));
ylabel('Amplitude');
xlabel('Time ');
subplot(3,1,2);
plot(t,s(t));
ylabel('Amplitude');
xlabel('Time ');
subplot(3,1,3);
plot(t,p(t));
ylabel('Amplitude');
xlabel('Time ');
axis([1 200 0 1.5]);
title('PWM Wave');

%regular sinewave message signal


%sawtooth signal

OUTPUT:-

LEARNING OUTCOME:
After performing the above experiment, I learntUsing PWM technique, any type of analog signal can be converted into a pulsating
signal with the help of pulse train(carrier).
Applications
As power loss is minimum in PWM, it can be used in designing switching circuits.
PWM technique can also be used to control power supplied to electrical devices like
motors.

You might also like