How to correct this issue with rectangularPulse funtion?
2 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Bartlett 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!