Fit der Fouriertransformation einer Korrelationsfunktion an analytische Fouriertransformation

1 view (last 30 days)
Hallo,
Die analytische Fouriertransformation der Korrelationsfunktion Corr = e^(-|t|/tau) ist die Funktion FT(Corr(t)) = 2*tau/(1+(2*pi*tau*f)^2).
Ich will nun die numerische Fouriertransformation (mit fft von MATLAB) der Korrelationsfunktion und die analytische FT plotten. Jedoch klappt das nur, wenn ich einen Offset und einen Multiplikationsfaktor hinzufüge und anfitte. Eigentlich sollte es ohne diese beiden Parameter das gleiche sein. (FT(Cor) entspricht einer Lorentzfunktion).
Liegt das vielleicht an der Diskretisierung?
Ich wäre sehr dankbar für Tipps und Hilfe!
Hier ist der Code:
% genutzte Variablen / Werte
tau = 2;
dt = 0.01;
start_dist = 0;
end_dist = 30;
t = start_dist:dt:end_dist;
fs = 1./dt;
N = length(t);
fshift = (-N/2:N/2-1)*(fs/N);
% Funktionen
Cor = exp(-abs(t)./tau);
corr_ft = fftshift(fft(Cor));
S_Lz = (2*tau)./( 1 +(2*pi*tau*fshift).^2 );
%Fit der Lorentzfunktion
start = [0, 1];
[param, ~] = fsolve(@(param)( param(1)+param(2) * ((2*tau)./( 1 +(2*pi*tau*fshift).^2 )) - corr_ft), start);
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead.
No solution found. fsolve stopped because the last step was ineffective. However, the vector of function values is not near zero, as measured by the value of the function tolerance.
Lz_fit = real(param(1))+real(param(2))* (2*tau)./( 1 +(2*pi*tau*fshift).^2 ) ;
% Figure
figure
plot(fshift, real(corr_ft))
hold on
plot(fshift, Lz_fit)
legend('{FT\{Corr({\tau})_{theo}\}}',['{\Re\{Lorentz-Fit\}: A+B\cdotLz(f)}\newlineA = ', num2str(round(real(param(1))*10)/10), ' ; B = ', num2str(round(real(param(2))*1000)/1000)])
set(gca, 'XScale', 'log')
set(gca, 'YScale', 'log')
title('FT(Corr) mit angefitteter Funktion Lz_{fit}')
xlabel('frequence f')
ylabel('S(f)')
figure;
plot(fshift, real(corr_ft))
hold on
plot(fshift, S_Lz)
plot(fshift, Lz_fit)
legend('{FT\{Corr({\tau})_{theo}\}}','S_Lz (ohne angefitteten Param)',['{\Re\{Lorentz-Fit\}: A+B\cdotLz(f)}\newlineA = ', num2str(round(real(param(1))*10)/10), ' ; B = ', num2str(round(real(param(2))*1000)/1000)])
set(gca, 'XScale', 'log')
set(gca, 'YScale', 'log')
title('FT(Corr) mit angefitteter Funktion Lz_{fit} und Lz ohne Parameter')
xlabel('frequence f')
ylabel('S(f)')
Warning: Negative data ignored
Warning: Negative data ignored

Answers (0)

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!