rectangularPulse: no drop to 1/2 at edges

조회 수: 1 (최근 30일)
T
T 2014년 6월 27일
편집: Matthew Suttinger 2018년 3월 30일
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!

답변 (2개)

Image Analyst
Image Analyst 2014년 6월 27일
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
Image Analyst
Image Analyst 2014년 6월 27일
편집: Image Analyst 2014년 6월 27일
T's "Answer" moved here since it's not an answer to the original question.
I can't, the width of the rectangular pulse depends on a syms variable :/ And besides that, I dont think fourier(myPulse,f,y) would work then anymore anyway.
Image Analyst
Image Analyst 2014년 6월 27일
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
Matthew Suttinger 2018년 3월 30일
편집: Matthew Suttinger 2018년 3월 30일
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'

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by