Forums

truncating the function and taking fft

Started by rahul ramchandran February 25, 2005


% Rectangular pulse,FFT shifted
N@0;
t=linspace(-10,10,2000);
n=0:N-1;%index
x = [zeros(1,220) ones(1,60) zeros(1,120)];%rectangular pulse
% plot(n,x);axis([0 400 -0.5 1.5]);grid on
xlabel('n');ylabel('x[n]');%pause;
X = ifft(x,2000);%fourier transform
X1=ifftshift(X);
plot(t,X1);
grid on;
xlabel('n');ylabel('X[n]');
axis([-2 2 -0.05 .05]);

Hi ,
I have this program which works fine giving me a plot of 2000 samples.
I want to truncate the sample at pts n=-1 and n = 1 (along x axis)and
then take the fft
of the samples lying between -1 and +1.
Can anyone guide me?
thanking you
rahul