1. % Space Vector Modulation Scheme
  2. % Daniel Amireh
  3.  
  4. clc
  5. clear all
  6.  
  7. % Input Parameters
  8. Vdc = 400; % DC Voltage
  9. Lf = 800e-6; % Inductance
  10. Cf = 400e-6; % Capacitance
  11. Lload = 2e-3; % Load Inductance
  12. Rload = 5; % Load Resistance
  13. f = 50; % Frequency
  14. w = 2 * pi * 50; % Angular Frequency
  15. Tz = 100e-6; % Sampling Time
  16. Vref = (2/3)*Vdc; % Reference Voltage
  17.  
  18. % Generation and plotting of PWM
  19.  
  20. for i=1:600
  21. if i>=300 && i<=600
  22. v0(i)=1
  23. else
  24. v0(i)=0
  25. end
  26. if i<=100 || i>=400
  27. v1(i)=1
  28. else
  29. v1(i)=0
  30. end
  31. if i<=200 || i>=500
  32. v2(i)=1
  33. else
  34. v2(i)=0
  35. end
  36. if i>=100 && i<=200 || i>=300 && i<=400 || i>=500
  37. v3(i)=1
  38. else
  39. v3(i)=0
  40. end
  41. if i>=100 && i<=400
  42. v4(i)=1
  43. else
  44. v4(i)=0
  45. end
  46. if i>=200 && i<=500
  47. v5(i)=1
  48. else
  49. v5(i)=0
  50. end
  51. if i<=100 || i>=200 && i<=300 || i>=400 && i<=500
  52. v6(i)=1
  53. else
  54. v6(i)=0
  55. end
  56. if i<=300
  57. v7(i)=1
  58. else
  59. v7(i)=0
  60. end
  61.  
  62. end
  63.  
  64.  
  65. % plot results
  66. i=1:600
  67. figure
  68. subplot(4,1,1) % subplot used to plot more than one graph on the same graph
  69. title('PWM siganls using SVM tehnique') %set title
  70. ylabel('V0') % set y-axis label
  71. grid on
  72. plot(i/600,v0)
  73. ylim([0 2])
  74.  
  75. subplot(4,1,2)
  76. ylabel('V1')
  77. grid on
  78. ylim([0 2])
  79. plot(i/600,v1)
  80.  
  81. subplot(4,1,3)
  82. ylabel('V2')
  83. grid on
  84. ylim([0 2])
  85. plot(i/600,v2)
  86.  
  87. subplot(4,1,4)
  88. ylabel('V3')
  89. grid on
  90. figure
  91. ylim([0 2])
  92. plot(i/600,v3)
  93.  
  94. subplot(4,1,1)
  95. plot(i/600,v4)
  96. ylabel('V4')
  97. grid on
  98. title('PWM siganls using SVM tehnique')
  99. ylim([0 2])
  100.  
  101. subplot(4,1,2)
  102. plot(i/600,v5)
  103. ylabel('V5')
  104. grid on
  105. ylim([0 2])
  106.  
  107. subplot(4,1,3)
  108. plot(i/600,v6)
  109. ylabel('V6')
  110. grid on
  111. ylim([0 2])
  112.  
  113. subplot(4,1,4)
  114. plot(i/600,v7)
  115. ylabel('V7')
  116. grid on
  117. ylim([0 2])
  118.  
  119. % line to line voltage plots VLAB, VLBC and VLCA
  120. figure
  121. subplot(3,1,1)
  122. t=.9:.001:1;
  123. f=400;
  124. V=300*sin(f*t)
  125. plot(t,V)
  126. grid on
  127. title('Line to line voltages')
  128. ylim([-400 400])
  129. ylabel('VLAB')
  130.  
  131. subplot(3,1,2)
  132. t=.9:.001:1;
  133. f=400;
  134. V=300*sin(f*t+120)
  135. plot(t,V)
  136. grid on
  137. ylim([-400 400])
  138. ylabel('VLBC')
  139.  
  140. subplot(3,1,3)
  141. t=.9:.001:1;
  142. f=400;
  143. V=300*sin(f*t+240)
  144. plot(t,V)
  145. grid on
  146. ylim([-400 400])
  147. ylabel('VLCA')
  148.  
  149. % Phase voltage plots VLAB, VLBC and VLCA
  150. figure
  151. subplot(3,1,1)
  152. t=.9:.001:1;
  153. f=400;
  154. V=300*sin(f*t)*2/3 % Phase voltage from line-to-line voltage
  155. plot(t,V)
  156. grid on
  157. title('Phase voltages')
  158. ylim([-400 400])
  159. ylabel('VLAn')
  160.  
  161. subplot(3,1,2)
  162. t=.9:.001:1;
  163. f=400;
  164. V=300*sin(f*t+120)*2/3
  165. plot(t,V)
  166. grid on
  167. ylim([-400 400])
  168. ylabel('VLBn')
  169.  
  170. subplot(3,1,3)
  171. t=.9:.001:1;
  172. f=400;
  173. V=300*sin(f*t+240)*2/3
  174. plot(t,V)
  175. grid on
  176. ylim([-400 400])
  177. ylabel('VLCn')