## Introduction

Pulse Width Modulation(PWM) working Principal using Matlab.

PWM stands for Pulse Width Modulation. It is a type of digital modulation that is widely used for controlling the power delivered to electrical devices, such as motors, lights, and heaters.

In PWM, the duty cycle of a square wave is varied to control the average value of the waveform, which is proportional to the power delivered to the device. The duty cycle is defined as the proportion of time that the square wave is in the “on” state to the total time it takes to complete one cycle. By varying the duty cycle, the average value of the waveform can be adjusted, and therefore the power delivered to the device can be controlled.

PWM is used in many applications because it is a simple and efficient way to control the power delivered to a device, while also reducing the amount of electromagnetic interference generated by the device. For example, in motor control, PWM is used to control the speed of a motor by adjusting the duty cycle of the square wave that is applied to the motor. By adjusting the duty cycle, the average voltage applied to the motor can be adjusted, which in turn changes the motor speed.

In PWM, the frequency of the square wave is typically much higher than the bandwidth of the device being controlled. This results in a low-frequency signal that is filtered out by the device, while the high-frequency component of the signal drives the device. This results in low electromagnetic interference and improved power efficiency

## PWM Components

- A Pulse Generator: This generates the square wave that serves as the base signal for the PWM waveform. The pulse generator can be a digital or analog circuit, and it produces a square wave with a fixed frequency and variable duty cycle.
- A Control Circuit: This circuit adjusts the duty cycle of the square wave in response to control signals from an external source, such as a microcontroller or a potentiometer. The control circuit can be an analog or digital circuit that implements a control algorithm to adjust the duty cycle based on the input signal.
- A Power Stage: This stage delivers the PWM signal to the load, such as a motor or a light. The power stage typically includes a power switch, such as a transistor or a MOSFET, and an output filter, such as a low-pass filter, to smooth out the PWM signal and produce a continuous average voltage that drives the load.
- A Load: This is the device that is being controlled by the PWM signal. The load can be a motor, a light, a heater, or any other device that requires power control.
- An optional Feedback Circuit: This circuit measures the response of the load to the PWM signal and provides feedback to the control circuit. The feedback circuit can be used to implement closed-loop control, where the duty cycle of the PWM signal is adjusted based on the load response, in order to maintain a desired setpoint.

## Duty Cycle of PWM

The duty cycle of a PWM waveform is the proportion of time that the waveform is in the “on” state, relative to the total time it takes to complete one cycle. It is expressed as a percentage or as a fraction of the total cycle time.

For example, if the PWM waveform is “on” for half of a cycle, and “off” for the other half of the cycle, the duty cycle would be 50%. If the PWM waveform is “on” for a quarter of a cycle, and “off” for the other three quarters of the cycle, the duty cycle would be 25%.

The duty cycle of a PWM waveform can be adjusted to control the average value of the waveform and, therefore, the power delivered to the load. For example, if the duty cycle is increased, the average value of the waveform increases, and more power is delivered to the load. Conversely, if the duty cycle is decreased, the average value of the waveform decreases, and less power is delivered to the load.

In PWM applications, the frequency of the waveform is typically much higher than the bandwidth of the load, so the load only responds to the average value of the waveform. By adjusting the duty cycle, the average value of the waveform can be controlled, and the power delivered to the load can be adjusted.

## Software Requirement

Matlab Software or Online Matlab

## Matlab Code

```
clc;
clear all;
close all;
F2=input('Messsage frequency=');
F1=input('Carrie Sawtooth Frequency=');
A=5;
t=0:0.001:1;
c=A.*sawtooth(2*pi*F1*t);
subplot(3,1,1)
plot(t,c);
xlabel('time')
ylabel('Amplitude');
title('Carrier Sawtooth Wave');
grid on;
m=0.75*A.*sin(2*pi*F2*t);
subplot(3,1,2);
plot(t,m);
xlabel('Time');
ylabel('Amplitude');
title('Message Signal');
grid on;
n=length(c);
for i=1:n
if (m(i)>=c(i))
pwm(i)=1;
else
pwm(i)=0;
end
end
subplot(3,1,3);
plot(t,pwm);
xlabel('Time');
ylabel('Amplitude');
title('plot of PWM');
axis([0 1 0 2]);
grid on;
```

## PWM Output

## Explore More Projects on Matlab

- Microwave and Antenna Various Matlab CodesMicrowave and Antenna Various Matlab Codes. Some of the Projects are below. Polar form for a Symmetrical Dipole of Finite… Read more: Microwave and Antenna Various Matlab Codes
- Multiple Input Multiple Output(MIMO) using MatlabIntroduction Multiple Input Multiple Output(MIMO) using Matlab. Multiple Input Multiple Output (MIMO) is a technology used in wireless communication systems… Read more: Multiple Input Multiple Output(MIMO) using Matlab
- Pulse Width Modulation(PWM) working Principal using MatlabIntroduction Pulse Width Modulation(PWM) working Principal using Matlab. PWM stands for Pulse Width Modulation. It is a type of digital… Read more: Pulse Width Modulation(PWM) working Principal using Matlab
- Quadrature Amplitude Modulation(QAM): Theory and MatlabIntroduction Quadrature Amplitude Modulation(QAM): Theory and Matlab QAM stands for Quadrature Amplitude Modulation. It is a method of combining two… Read more: Quadrature Amplitude Modulation(QAM): Theory and Matlab
- Polar form for a Symmetrical Dipole of Finite Length: Matlab ScriptPolar form for a Symmetrical Dipole of Finite Length: Matlab Script. This Experiment include finding of: Introduction The polar form… Read more: Polar form for a Symmetrical Dipole of Finite Length: Matlab Script
- Radiated Power and Maximum Directivity of any Antenna: Theory and Matlab codeRadiated Power and Maximum Directivity of any Antenna: Theory and Matlab code. Introduction The radiated power of an antenna refers… Read more: Radiated Power and Maximum Directivity of any Antenna: Theory and Matlab code
- Polar form for a Loop Antenna with Uniform Current: Theory and Matlab codeIntroduction The polar form for a loop antenna with uniform current can be determined using the far-field approximation and the… Read more: Polar form for a Loop Antenna with Uniform Current: Theory and Matlab code
- Two Dimensional(2-D) Polar and Semi-Polar Patters using Matlab codeIntroduction Two Dimensional(2-D) Polar and Semi-Polar Patters using Matlab code. Two-dimensional (2-D) polar and semi-polar patterns are graphical representations of… Read more: Two Dimensional(2-D) Polar and Semi-Polar Patters using Matlab code

## Join us for Regular Updates

Telegram | Join Now |

Join Now | |

Join Now | |

Join Now | |

Join Now | |

Join our Telegram | connectkreations |

**About Connect Kreations**

We the team Connect Kreations have started a Blog page which is eminently beneficial to all the students those who are seeking jobs and are eager to develop themselves in a related area. As the world is quick on uptake, our website also focuses on latest trends in recent technologies and project learning and solutions. We are continuously putting our efforts to provide you with accurate, best quality, and genuine information. Here we also have complete set of details on how to prepare aptitude, interview and more of such placement/ off campus placement preparation.

**Connect Kreations is excited to announce the expansion of our services into the realm of content creation! We are now offering a wide range of creative writing services, including poetry, articles, and stories.**

Whether you need a heartfelt poem for a special occasion, a thought-provoking article for your blog or website, or an engaging story to captivate your audience, our team of talented writers is here to help. We have a passion for language and a commitment to creating high-quality content that is both original and engaging.

Our services are perfect for individuals, businesses, and organizations looking to add a touch of creativity and personality to their content. We are confident that our unique perspectives and diverse backgrounds will bring a fresh and exciting voice to your project.

**Thank you for choosing Connect Kreations for your content creation needs. We look forward to working with you and helping you to bring your vision to life!**

The website is open to all and we want all of you to make the best use of this opportunity and get benefit from it..🤓

**Our Websites: Connect Kreations**