12345678910111213141516171819202122232425262728 |
- function [outtrace] = Filter_IFFT(intrace, frq1, frq2, sfrq, no)
- % Calc FFT-like square------
- fmax=sfrq/2;
- ll = length(intrace);
- if mod(length(intrace),2) > 0
- intrace = intrace(1:ll-1);
- end
- Fpts = length(intrace)/2;
- lpfrqs=round(Fpts*frq1/fmax);
- if lpfrqs < 1
- lpfrqs = 1;
- end
- hpfrqs=round(Fpts*frq2/fmax);
- Fwindow = ones(1,Fpts)*0.0000001;
- Fwindow(lpfrqs:hpfrqs)=1;
- Fwindow = [Fwindow fliplr(Fwindow)]';
- if no == 1
- Fwindow = Fwindow +1;
- Fwindow = mod(Fwindow,2);
- end
- %----------------------------
- FFT = fft(intrace);
- mag = abs(FFT);
- mag = (mag.*Fwindow); % .* elementwise multiplication and exch row/columns
- phase = angle(FFT); % exch row/columns
- % % ifft---------------------
- filteredSpec =mag.*exp(1i.*phase); % Lu .* array multiplication
- outtrace=real(ifft(filteredSpec))'; % % exch row/columns Lu
|