# rectangularPulse: no drop to 1/2 at edges

4 views (last 30 days)
T on 27 Jun 2014
Edited: Matthew Suttinger on 30 Mar 2018
Hello I want to do the fourier of a rectangular pulse which is also 1 at the edges, so that the fourier returns a sinc function. rectangularPulse drops to 1/2 at the edges and does not seem to return the equivalent function if I plot the result vs. a sinc function. I tried ceil but this is not accepted with the fourier function.
Thanks a lot!

Image Analyst on 27 Jun 2014
So just create it manually
myPulse = [0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ];
##### 2 CommentsShow 1 older commentHide 1 older comment
Image Analyst on 27 Jun 2014
Make it depend on the variable:
signalLength = 512; % whatever.
myPulse = zeros(1, signalLength);
startingIndex = 20; % Whatever
pulseWidth = 64; % Whatever, e.g. your syms variable value.
myPulse(startingIndex:(startingIndex + pulseWidth - 1)) = 1;

Matthew Suttinger on 30 Mar 2018
Edited: Matthew Suttinger on 30 Mar 2018
If you don't mind converting it to a double after applying inputs, wrap the result in the ceil() function.
y = ceil(rectangularPulse(x_start,x_end,x_values));
class(y) % ans = 'double'