Problem using ifft and fft
2 views (last 30 days)
Show older comments
Dear all,
I am facing a problem in the use of the fft and ifft. What i am try to do is not particularli complicated. I would like to extract the vector g coming from the deconvolution of two exponential functions namely f and h where
f = exp(-exp(x-log(tau0))*beta) ; h = exp(-exp(x));
The idea is to deconvolute them using the properties of the Fourier transform since I cannot find an easier deconvolution algorithm. However when i apply this the results are complitely wrong.
clear all
beta = 0.2;
tau0 = 1;
%%% definition xaxis log scale x = ln(t)
x = (-15:0.01:10);
%%% definition pure exponential decay and stretched exponential decay
f = exp(-exp((x-log(tau0))*beta));
h = exp(-exp(x));
%%% test with derivatives
df = diff(f);
dh = diff(h);
%%% deconvolution of f and h to find g
F = fftshift(fft(f));
H = fftshift(fft(h));
G = ifft(ifftshift(F./H));
figure(1)
yyaxis left
plot(x,h);
ylabel('h(x)')
hold on
yyaxis right
ylabel('f(x)')
plot(x,f);

0 Comments
Answers (1)
Matt J
on 15 Dec 2020
Edited: Matt J
on 15 Dec 2020
Make sure you are familiar with the concepts here,
2 Comments
Matt J
on 17 Dec 2020
Edited: Matt J
on 17 Dec 2020
Try this,
beta = 0.3;
tau0 = 1;
step = 0.001;
N=1e5;
x = step*( (0:N-1) -ceil((N-1)/2) );
f = exp(-exp((x-log(tau0))*beta));
h = exp(-exp(x));
%%% Numerical differentiation (right hand derivatives)
df = [diff(f),0]/step;
dh = [diff(h),0]/step;
%%Fourier transformation of the derivatives
dF = fft(ifftshift(df))*step;
dH = fft(ifftshift(dh))*step;
%%% deconvolution of dF and dH
g = ifft(divSpectrum(dF,dH),'symmetric')/step;
g = fftshift(g);
plot(x, conv(dh,g,'same')*step, x(1:500:end),df(1:500:end),'x');
legend('conv(dh,g)', 'df')
function Q=divSpectrum(dF,dH)
tol=1e-5;
supp=abs(dF)>tol & abs(dH)>tol;
Q=dF./dH;
Q(~supp)=0;
end
See Also
Categories
Find more on Special Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!