Problem using ifft and fft
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Matt J
2020-12-15
编辑:Matt J
2020-12-15
Make sure you are familiar with the concepts here,
2 个评论
Matt J
2020-12-17
编辑:Matt J
2020-12-17
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Special Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
