i want to generate a pwm of variable duty cycle
조회 수: 3(최근 30일)
표시 이전 댓글
i want to generate a pwm of variable duty cycle like first 200 ms duty cycle should be 35%,for next 250 ms duty cycle should be 50%, for next 500 ms duty cycle should be 80% and for rest of time is 100%.How to acheive this function.Thanks in advance.
댓글 수: 0
답변(2개)
VBBV
2021년 10월 10일
편집: VBBV
2021년 10월 10일
A = 1;% normalized amplitude
T = 0:0.1:2000; % millisec
Sx = zeros(length(T),1);
i = 1;
while i<=length(T)
if T(i)<200
Sx(i) = 0.35*A;
elseif T(i)>=200 & T(i)<=450
Sx(i) = 0.5*A;
elseif T(i)>=450 & T(i)<= 950
Sx(i) = 0.8*A;
elseif T(i)>=950 & T(i)<=1000
Sx(i) = 0;
elseif T(i)<1000+200
Sx(i) = 0.35*A;
elseif T(i)>=1000+200 & T(i)<1000+450
Sx(i) = 0.5*A;
elseif T(i)>=1000+450 & T(i)<1000+950
Sx(i) = 0.8*A;
else
Sx(i) = 0;
end
i = i+1;
end
plot(T,Sx,'linewidth',2)
axis([0 2000 0 1.5]);
grid
you can try this, but using Simulink generator would be good option
댓글 수: 0
커뮤니티
더 많은 답변 보기: Power Electronics Community
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!