# MATLAB user defined inverse fourier transform

Hi i am stuck with a program in MATLAB to find the time domain impulse response of a system from its continuous transfer function in the frequency domain.

Here is the program-
delt=1.5625e-9; %definition of delta t(sampling time).To be taken sufficiently small depending upon the time constant of the original signal.

delomg=1/(N*delt); % Kept sufficiently small to prevent repetition of curves in the plot due to aliasing .

komg=[-100*pi/(delt):delomg:100*pi/(delt)]; %matrix containing the omegas over which the summation is done.Should be sufficiently large to cover all the frequencies present the original signal.

s=sqrt(-1)*komg; %definition of s=jw

transfer_func_image= 1 -(s.*r1*(c1+c2) +1)./(s.^2.*r1.*r2.*c1.*c2 + s.*(r1*c1 + r2*c2+ r1*c2) +1);

h_image_dirac=zeros(1,N); %initialisation of the h_image matrix for better speed

for n=1:N % first sample at t=0
t=(n-1)*delt;
sumint_image = sum(transfer_func_image.*exp(s.*t).*delomg);
h_image_dirac(n)=(1./(2*pi)).*sumint_image;
end

This program defines a transfer function in terms of s.
The last part of the program starting from for n= 1:N , then integrates the transfer function by multiplying the transfer function vector with exp(j*omega*t) and summing the vector obtained after multiplying it with delomg.This duplicates the formula of laplace transform for the special case where the real part of s =0 and is thus effectively inverse fourier transform.

The problem is the program is not giving the right result.If i find the value of the transfer function above at 2Meg, it is of the order of 10^-4
but if i use this program to obtain the impulse response and then convolve that with a sine wave at 2meg the answer is of the order of 100 and not 10^-4.

Where am i going wrong?This program works fine for another transfer function which i have tested.