How to correct this issue with rectangularPulse funtion?

This is my first time posting and I am slightly new to using Matlab. I am currently trying to create a rectangular waveform which goes from 0 to 4T0, and I am having an issue with the rectangular pulse function starting and ending at 0.5 instead of 0. Am I doing something incorrectly? My code is posted below:
T0 = 1; fs = 16; A = 1;
ts = 16;
t = 0:T0/(ts-1/ts):4*T0;
n = 16; %fft with padding to make the vector length equal to 1024
S1 = rectangularPulse((t - (T0/2))/T0);
S2 = rectangularPulse((t - (3*T0/2))/T0);
S3 = rectangularPulse((t - (5*T0/2))/T0);
S4 = rectangularPulse((t - (7*T0/2))/T0);
xt = A*T0*(S1-S2+S3-S4);
figure;plot(t,xt);

Réponses (0)

Catégories

En savoir plus sur Communications Toolbox dans Centre d'aide et File Exchange

Produits

Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by