- #1
Frank Einstein
- 170
- 1
Hello everybody.
I am triying to calculate a band-pass filter using the Fourier transform.
I have a vector with 660 compomponents; one for each month. I am looking for a phenomenon which has a periodicity between 3 and 7 years (it's el niño, on the souhtern pacific ocean). I want to make zero all the coefficients of the Fourier transform except the ones which are in between 3 and 7 years. I have tried to remove all of the coefficients which are between the 36th (12*3) and 84th (12*7). Then, I proceed to do the same thing in the other half of the series to mantain simmetry.
But once I make the inverse Fourier transform and I plot it, the results don't match whith what I want.
Can someone tell me where is my faliure?Code used:
niniofourier=fft(ninios);
for i=1:35
niniofourierb(i)=0;
end
for i=85:330
niniofourierb(i)=0;
end
for i=36:84
niniofourierb(i)=niniofourier(i);
end
for i=331:576
niniofourierb(i)=0;
end
for i=577:624
niniofourierb(i)=niniofourier(i);
end
for i=625:660
niniofourierb(i)=0;
end
niniosi=ifft(niniofourierb);
figure(4)
plot (niniosi)
I am triying to calculate a band-pass filter using the Fourier transform.
I have a vector with 660 compomponents; one for each month. I am looking for a phenomenon which has a periodicity between 3 and 7 years (it's el niño, on the souhtern pacific ocean). I want to make zero all the coefficients of the Fourier transform except the ones which are in between 3 and 7 years. I have tried to remove all of the coefficients which are between the 36th (12*3) and 84th (12*7). Then, I proceed to do the same thing in the other half of the series to mantain simmetry.
But once I make the inverse Fourier transform and I plot it, the results don't match whith what I want.
Can someone tell me where is my faliure?Code used:
niniofourier=fft(ninios);
for i=1:35
niniofourierb(i)=0;
end
for i=85:330
niniofourierb(i)=0;
end
for i=36:84
niniofourierb(i)=niniofourier(i);
end
for i=331:576
niniofourierb(i)=0;
end
for i=577:624
niniofourierb(i)=niniofourier(i);
end
for i=625:660
niniofourierb(i)=0;
end
niniosi=ifft(niniofourierb);
figure(4)
plot (niniosi)