modulate delivers asynchronous result
Show older comments
Hi,
I want to use modulate to get a pulse width modulated signal for a 200Hz signal at a sample rate of 8kHz.
this is my code
f_el=200;
fsw=8000;
stop_time=1/f_el;
step_fundamental=1/f_el/200;
t_fundamental=0:step_fundamental:stop_time;
sine=0.5*(sin(2*pi*f_el*t_fundamental)+1);
%% simple pwm modulation
y=modulate(sine,f_el,fsw,'pwm');
step_sw=stop_time/length(y);
t_sw=stop_time/length(y):step_sw:stop_time;
%
figure
hold on
plot(t_fundamental,sine,'linewidth',2)
plot(t_sw,y)
% plot(t_sw,1-y)
However, the result is an asynchronous pwm pattern with a larger area of "1" than "0".
Do you know why and can help me?
Thanks in advance
Accepted Answer
More Answers (0)
Categories
Find more on Pulse width modulation (PWM) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


