Fitting experimental data with experimental references

Hi, I have an iron compound that I know that has Fe, Fe2+ and Fe3+. In a XANES experimental data of my compound all the contributions overlap. I already have the expected shape of the Fe, Fe2+ and Fe3+ species. Thus, I need to fit the experimetnal data of my compound using the threee references, and calculate the relative amount of both species.
I believe it is an optimiation problem. Could some one help me to get the script to do it in matlab.
So I far his is what I got
prob = optimproblem('ObjectiveSense','min');
w1=optimvar("w1");
w2=optimvar("w2");
w3=optimvar("w3");
Yt2=Yls*w1+Yhs*w2+Y3*w3;
Ymin=Yt2-Yt;
prob.Objective =Ymin ;
show(prob)
initialGuess.w3 = 0.1;
initialGuess.w2 = 0.5;
initialGuess.w1 = 0.4;
[sol,optval] = solve(prob,initialGuess)
w1Opt = sol.w1
w2Opt = sol.w2
w3Opt = sol.w3
However, the values that I got are absurd, too high, like 30 or negative la -50, and they values should renge between 0-1

 採用された回答

Torsten
Torsten 2022 年 8 月 12 日

0 投票

w = [Yls,Yhs,Y3]\Yt
if Yls, Yhs, Y3 and Yt are column vectors of the same size.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeBiological and Health Sciences についてさらに検索

質問済み:

2022 年 8 月 12 日

コメント済み:

2022 年 8 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by