-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathTwoLorentzModel.m
executable file
·28 lines (22 loc) · 998 Bytes
/
TwoLorentzModel.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function Lorentz=TwoLorentzModel(x, freq)
% CJE LorentzModel
% Lorentzian = (1/pi) * (hwhm) / (deltaf^2 + hwhm^2) (Wolfram)
% Peak height of Lorentzian = 4 / (pi*hwhm)
% This defnition of the Lorentzian has Area = 1
area = x(1);
hwhm = x(2);
f0 = x(3);
phase = x(4);
baseline0 = x(5);
baseline1 = x(6);
Absorption = 1/(2*pi) * area * ones(size(freq)) .* hwhm ./ ((freq-f0).^2 + hwhm.^2)+ ...
1/(2*pi) * area *x(7) * ones(size(freq)) .* hwhm ./ ((freq-f0-0.18).^2 + hwhm.^2);
Dispersion = 1/(2*pi) * area * (freq-f0) ./ ((freq-f0).^2 + hwhm.^2) + ...
1/(2*pi) * area * x(7) * (freq-f0-0.18) ./ ((freq-f0-0.18).^2 + hwhm.^2);
Lorentz = Absorption*cos(phase) + Dispersion * sin(phase) ...
+ baseline0 + baseline1*(freq-f0);
% from Lorentz component of LorentzGauss model
%F = (x(1)*ones(size(freq))./(x(2)^2*(freq-x(3)).*(freq-x(3))+1)) ...
% .* (exp(x(6)*(freq-x(3)).*(freq-x(3)))) ... % gaussian
% + x(4)*(freq-x(3)) ... % linear baseline
% +x(5); % constant baseline