If you goto 14 minutes and 53 seconds of this video: https://youtu.be/xfxQ-zBp2OQ you will see a plot of Pulse Width Modulation (PWM) and Pulse Position Modulation (PPM) for a simple sine wave signal.
The picture should look something like this:
How do I implement a PPM for a sine wave in MATLAB? Here is what I am thinking:
t = 0:1/1e3:60;
d = [0:2:60;sin(2*pi*0.05*(0:2:60))]';
x = @rectpuls;
y = pulstran(t,d,x);
plot(t,y)
hold off
xlabel('Time (s)')
ylabel('Waveform')
But this gives me a plot of rectangular samples of the sine wave:
not the PPM as shown in the first graphic above.
So even though I understand what the YouTuber is doing graphically, I'm not sure how this can be implemented in MATLAB from an algorithmic standpoint.
I would appreciate any feedback from the EE community.