# i want to generate a pwm of variable duty cycle

조회 수: 3(최근 30일)
편집: VBBV 2021년 10월 10일
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.

댓글을 달려면 로그인하십시오.

### 답변(2개)

Nisar Ahmed 2020년 4월 30일
Share me nisark37@gmail.com
##### 댓글 수: 0표시숨기기 이전 댓글 수: -1

댓글을 달려면 로그인하십시오.

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

댓글을 달려면 로그인하십시오.

### 커뮤니티

더 많은 답변 보기:  Power Electronics Community

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!