n=1024;dt=0.01;
t=(0:n-1)*dt;
omega = 2*pi*1; % [Hz]
y=sin(omega*t);
ffty=fft(y);
index1= round(F1*(dt*n));
index2= round(n-F1*(dt*n));
Lowpass=ones(size(ffty)); 
Lowpass(index1+1:index2-1)=zeros(size(Lowpass(index1+1:index2-1)));
index1= round(F2*(dt*n));
index2= round(n-F2*(dt*n));
Highpass=zeros(size(ffty)); 
Highpass(index1:index2)=ones(size(Highpass(index1:index2)));
yout = real(ifft(Lowpass.* Highpass.*ffty));
