You are on page 1of 3

SIMULATION OF SINUSOIDAL PULSE WIDTH MODULATION (SPWM)

TECHNIQUE

1.1 Objectives
1 To understand the operation theory of SPWM
2 To simulate SPWM using Matlab
3 To simulate SPWM using Multisim
1.2 Basic Theory
Give a brief explanation about:
1. Pulse Width Modulation (PWM)
2. Sinusoidal Pulse Width Modulation (SPWM)
1.3 Experiment Apparatus
1. Matlab software
2. Multisim software
1.4 Procedures
1.4.1 Matlab Simulation
1. Type the following script onto your M-File
1. ft=input('Comparator Triangular frequency:'); %input your
presence number
2. fm=input('Message frequency:'); %input 0.1*your presence
number
3. a=input('Enter Amplitude of Message signal:'); %input
0.1*your presence number
4. b=input('Enter Amplitude of Triangular Signal:'); %input
0.1*your presence number
5. f_sampling=100*ft; %sampling frequency
6. t=0:1/f_sampling:2/fm;
7.
8. stooth=b.*sawtooth(2*pi*ft*t,0.5); %generating a triangular
wave
9. subplot(2,1,1);
10. plot(t,stooth,'k-'); % plotting the triangular wave
11.
12. msg=a.*sin(2*pi*fm*t); %generating message wave
13. hold on
14. plot(t,msg,'r-'); %plotting the sinusoidal message wave
15. title('Comparator and Message Wave');
16. legend('Comparator Wave','Message Wave'); %attach legend on
the figure
17.
18. pwm=zeros(1,length(stooth));

DIGITAL TELECOMMUNICATION LAB 1


SIMULATION OF SINUSOIDAL PULSE WIDTH MODULATION (SPWM)
TECHNIQUE
19. for i=1:length(stooth)
20. if (msg(i)>=stooth(i))
21. pwm(i)=1; %is message signal amplitude at i th sample is
greater than
22. %sawtooth wave amplitude at i th sample
23. else
24. pwm(i)=0;
25. end
26. end
27.
28. subplot(2,1,2);
29. plot(t,pwm,'b');
30. title('SPWM signal');
31. axis([0 max(t) 0 1.1]); %to keep the pwm visible during
plotting.

2. Input your presence number as fs value. For fm, a, and b value, input 0.1 × your
presence number. For example, if your presence number is 28, then, the value of:
= 28
= 0.1 × 28 = 2.8
= 0.1 × 28 = 2.8
= 0.1 × 28 = 2.8
3. Observe the result.

1.4.2 Multisim Simulation


1. Create SPWM circuit as shown in Fig. 1. You can use two two-channel-
oscilloscopes if your multisim doesn’t support 4-channel one.
XSC1

VCC T

XFG1 5.0V A B C D

COM U2
7

5
1

3 U1
6
XFG2 2
BUFFER
COM
LM741AH/883
4

VEE

-5.0V

2. Set Function Generator 1 to produce sinusoidal message signal with


frequency = 0.1 × kHz and amplitude of 0.1 ×
Vp.

DIGITAL TELECOMMUNICATION LAB 2


SIMULATION OF SINUSOIDAL PULSE WIDTH MODULATION (SPWM)
TECHNIQUE
3. Set Function Generator 2 to produce triangular comparator signal with =
kHz and amplitude of 0.1 × Vp and
50% duty cycle.
4. Example: if your presence number is 28, then:
a. Function Generator 1 = sinusoidal signal
= 0.1 × 28 = 2.8 .
Amplitude = 0.1 × 28 = 2.8
b. Function Generator 2 = triangular signal with 50% duty cycle
= 28 .
Amplitude = 0.1 × 28 = 2.8
5. Observe the output

1.5 Measurement Results and discussion


1. Write the Matlab source code that you used to generate the modulated signal, including
explanation of each code line!
2. Show your matlab simulation result and variables value!
3. Show your multisim simulation result and variables value!
4. Based on the simulation result, what is the basic principle of SPWM?
5. Write minimum 2 implementations of PWM technique!

1.6 Conclusion

DIGITAL TELECOMMUNICATION LAB 3


SIMULATION OF SINUSOIDAL PULSE WIDTH MODULATION (SPWM)
TECHNIQUE

You might also like