I need to generate a PWM signal with duty cycle after a sine. How I can do this in simulink and after this to simulate on a microcontroller F28027 PICCOLO ?
Asked
Active
Viewed 608 times
-1
-
Did you try the PWM Generator block? – Daniel Apr 09 '16 at 09:50
-
ok I put that block, but after that, what I need to do to have a PWM with duty cycle after a sine? – user Apr 10 '16 at 06:29
1 Answers
0
I am unsure about your requirement.I think the below codes might help you as first step. I think this must generate PWM signal.
percent=input('Enter the percentage:');
TimePeriod=input('Enter the time period:');
Cycles=input('Enter the number of cycles:');
x=0:0.01:Cycles*TimePeriod;
t=(percent/100)*TimePeriod;
for n=0:Cycles
y(((n*TimePeriod)< x) & (x<(n*TimePeriod+t))) = 1;
y(((n*TimePeriod+t)< x)& (x<((n+1)*TimePeriod))) = 0;
plot(y,'b','LineWidth',2)
grid on
end

HEMS
- 187
- 1
- 5
- 17