MATLAB: Help applying band pass filter to frequency domain data

band pass filterfrequency domaininverse fast fourier transformMATLABtime domain

I have data in a matrix M (4500 x 3).
  • 1st column (frequency values ranging 4-10 GHz)
  • 2nd column (magnitude)
  • 3rd column (phase)
I want to perform two tasks:
1) apply following band pass filter on this frequency domain data.
G = sin(a)/a*sin(n/N) ;
a = t*(f-fc)
Where
N = Total number of discrete frequencies
n = frequency sample index
t = gate width in time domain (1-4 ns)
f = frequency in GHz
fc = central frequency in GHz
2) how to convert this frequency domain data into time domain data what i believe is that presently values of column 2 and column 3 are in frequency domain. Do i simple write this to convert into time domain
output = ifft(M)
I read matlab documents but could not find method to define this filter.

Best Answer

%make some test data
f=4e9+5e9*rand(4500,1);
m=rand(4500,1);
ph=rand(4500,1);
data=[f m ph];
fc=5e9; %cut frequency
t=4e-9; %width
N=4500; %number of samples
a=t*(data(:,1)-fc); %???? what to call the a values?!
G=zeros(4500,1); %preallocate the memory for the filter
%get the values of the filter for each sample
for idx=1:4500
G(idx)=sin(a(idx))/a(idx)*sin(idx/N);
end
FilteredMag=G.*data(:,2); %Apply the filter to the magnitude of the signal
I have no idea what the time values are because I don't know Fs (the sampling frequency).