% fonctionnes de commutation convertisseur triphasé six-step PWM. Jesus Morales % ELE4801. Machines et entraînements électriques. Hiver 2018. close all; clear; clc f = 100; w = 2*pi*f; fsw = 3e3; wsw = 2*pi*fsw; Tsw = 1/fsw; d = 0.75; dt = 1e-6; t = 0:dt:1/f; N = length(t); s1 = zeros(1,N); s2 = zeros(1,N); s3 = zeros(1,N); c = zeros(1,N); tri = zeros(1,N); for n=1:N theta = mod(w*t(n)+pi/3,2*pi); if theta < pi/3, s1(n) = 1; s3(n) = 1; elseif theta < 2*pi/3, s1(n) = 1; elseif theta < pi, s1(n) = 1; s2(n) = 1; elseif theta < 4*pi/3, s2(n) = 1; elseif theta < 5*pi/3, s2(n) = 1; s3(n) = 1; elseif theta < 2*pi, s3(n) = 1; end delta = mod(wsw*t(n),2*pi); if delta < pi, tri(n) = delta/pi; else tri(n) = 2 - delta/pi; end if d > tri(n), c(n) = 1; end end s1 = s1.*c; s2 = s2.*c; s3 = s3.*c; figure subplot(4,1,1); plot(w*t/(pi/3),tri); hold on; plot(w*t/(pi/3),ones(1,N)*d); grid; ylim([-0.2 1.2]); title('s_1') subplot(4,1,2); plot(w*t/(pi/3),s1); grid; ylim([-0.2 1.2]); title('s_1') subplot(4,1,3); plot(w*t/(pi/3),s2); grid; ylim([-0.2 1.2]); title('s_2') subplot(4,1,4); plot(w*t/(pi/3),s3); grid; ylim([-0.2 1.2]); title('s_3')