Maxwell-Boltzmann Fit with different constant (air-absorption) for each data Point

38 views (last 30 days)
Hello together,
I measuerd with a spectrometer a x-Ray-spectrum. I found Bremsstrahlung and characteristic radiation. I like to do a fit using the Maxwell-Boltzman distribution. The measurment is done under atmosphere of air, so I need to take into account the energy dependend apsorption of air, which is differnet for each data point. The peaks (red in pot) of characteristic radiation I smoothed with a linear function. (blue curve in the plot)
Maxwell-Boltzmann equation is the following: (where x=E is an array E=2:0.077:20 , dE=0.077)
(orange curve in plot)
and air Absorption with Lambert-Beers-law is
~
d ist the distance from the spectrometer to the x-Ray point source d=0.15m and µ(E) is the mass specific absorption coefficient of air which dependes on E: my=µ=[µ1,µ2,....µN] with N=length(E). Finally every data point of the upper Maxwell-Boltzmann distribution has to be multiplied with
=>.* to get the correct fit. (black curve in plot, found by manual paying with the parameters)
I couldn't give the fit function for every data point an other value of my=µ whitch I want to input as an array
ft = fittype('A*exp(-d*my).*sqrt(4*x/(pi*(B)^3)).*exp(-x/B)','options',fo);
From the fit parameter B I want to extract electron temerature T_e.
How can I get a fit and input an array of which will be took into account for each data point in the fitroutine?

Answers (1)

Alan Stevens
Alan Stevens on 4 May 2021
Edited: Alan Stevens on 4 May 2021
You could try using fminsearch to estimate B. Something along the lines of:
data = % enter your data to be fitted
my = % enter your mu values
E = % enter your energy values
B0 = % supply an initial guess for B
B = fminsearch(@(B), fn(B,E,my,data), B0);
function F = fn(B,E,my,data)
d = 0.15;
fit = exp(-d*my).*sqrt(4*E/(pi*(B)^3)).*exp(-E/B);
F = norm(data - fit);
end

Categories

Find more on Curve Fitting Toolbox 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!