קובץ:Desommation gaussienne lorentzienne.svg

תוכן הדף אינו נתמך בשפות אחרות.
מתוך ויקיפדיה, האנציקלופדיה החופשית

לקובץ המקורי(קובץ SVG, הגודל המקורי: 610 × 460 פיקסלים, גודל הקובץ: 59 ק"ב)

ויקישיתוף זהו קובץ שמקורו במיזם ויקישיתוף. תיאורו בדף תיאור הקובץ המקורי (בעברית) מוצג למטה.

תקציר

תיאור
English: Non linear regression to fit the curve with the sum of a lorentzian function and a gaussian function.
Français : Régression non linéaire pour ajuster la courbe avec la somme d'une fonction lorentzienne et d'une fonction gaussienne.
תאריך יצירה
מקור נוצר על־ידי מעלה היצירה
יוצר Cdang

Scilab source

English: English version by default.
Français : Version française, si les préférences de votre compte sont réglées (voir Special:Preferences).


File gaussian_lorentzian_functions.sci: the function we are working with (library).

// *************
// * Fonctions *
// *************

// Gaussian function centered on 0

function [y] = gauss(A, x)
    // A(1) : peak height
    // A(2) : peak "width"
    y = A(1)*exp(-x.*x/A(2));
endfunction

// Lorentzian function centered on 0

function [y] = lorentz(A, x)
    // A(1) : peak height
    // A(2) : peak "width"
    foo = A(2)*A(2);
    y = foo*A(1)./(foo + 4*x.*x);
endfunction

function [y] = profile(A, x)
    // A(1) : lorentzian peak height
    // A(2) : lorentzian peak "width"
    // A(3) : gaussian peak height
    // A(4) : gaussian peak "width"
    L = A(1:2);
    G = A(3:4);
    y = lorentz(L, x) + gauss(G, x);
endfunction

File gaussian_lorentzian_peak_generator.sce: creates a data set and saves it in the noisy_gaussian_lorentzian_peak.txt file.

chdir("mypath\");

exec("gaussian_lorentzian_functions.sci")

// *************
// * Constants *
// *************

paramlorentz(1) = 5; // height of the lorentzian curve
paramlorentz(2) = 2; // "width" of the lorentzian curve
paramgauss(1) = 10; // height of the gaussian curve
paramgauss(2) = 3; // "width" of the gaussian curve
var=0.5; // variance of the noise normal law

nbpts = 100 // number of points
halfwidth = max(3*paramgauss(2), 3*paramlorentz(2)) // for x range
step = 2*halfwidth/nbpts;

// ******************
// * Initialisation *
// ******************

X = zeros(nbpts,1);
Y = zeros(nbpts,1);

// ****************
// * Main program *
// ****************

// Data generation

i=(1:nbpts)'
X = step*i - halfwidth;
Y = profile([paramlorentz;paramgauss], X) + var*rand(X, "normal");
end

// Saving

csvWrite([X, Y], "noisy_gaussian_lorentzian_peak.txt")

File gauss_lorentz_desummation.sce: process the data to extract the lorentzian and the gaussian components.

// ******************
// * Initialisation *
// ******************

clf;
chdir("mypath\");
exec("gaussian_lorentzian_functions.sci")

// *************
// * Constants *
// *************

Ainit = [1;1;1;1]; // initial parameters of the model function

// *************
// * Functions *
// *************

// Residual function

function [e] = res(A, x, y)
    e = profil(A, x) - y;
endfunction

// ****************
// * Main program *
// ****************

// Data reading

data = csvRead("noisy_gaussian_lorentzian_peak.txt")
X = data(:,1);
Y = data(:,2);

// Data processing

[S, Aopt] = leastsq(list(res, X, Y), Ainit)
Yopt = profil(Aopt, X);
YLopt = lorentz(Aopt(1:2),X);
YGopt = gauss(Aopt(3:4),X);

// Display

plot(X, Yopt, "-r")
plot(X, YLopt, "-c")
plot(X, YGopt, "-g")
plot(X, Y, "+b")

height = max(Y);
xmin = min(X)

xstring(xmin, height*0.95,...
 "lorentzian: Al = "+string(0.01*round(100*Aopt(1)))...
+"; Hl = "+string(0.01*round(100*Aopt(2))))
xstring(xmin, 3*height/4,...
 "gaussian: Ag = "+string(0.01*round(100*Aopt(3)))...
+"; Hg = "+string(0.01*round(100*Aopt(4))))
xstring(xmin, height/2,...
 "variance: S = "+string(0.01*round(100*S)))

רישיון

אני, בעל זכויות היוצרים על עבודה זו, מפרסם בזאת את העבודה תחת הרישיון הבא:
w:he:Creative Commons
ייחוס שיתוף זהה
הקובץ הזה מתפרסם לפי תנאי רישיון קריאייטיב קומונז ייחוס-שיתוף זהה 3.0 לא מותאם.
הנכם רשאים:
  • לשתף – להעתיק, להפיץ ולהעביר את העבודה
  • לערבב בין עבודות – להתאים את העבודה
תחת התנאים הבאים:
  • ייחוס – יש לתת ייחוס הולם, לתת קישור לרישיון, ולציין אם נעשו שינויים. אפשר לעשות את זה בכל צורה סבירה, אבל לא בשום צורה שמשתמע ממנה שמעניק הרישיון תומך בך או בשימוש שלך.
  • שיתוף זהה – אם תיצרו רמיקס, תשנו, או תבנו על החומר, חובה עליכם להפיץ את התרומות שלך לפי תנאי רישיון זהה או תואם למקור.

כיתובים

נא להוסיף משפט שמסביר מה הקובץ מייצג
Non linear regression to fit the curve with the sum of a lorentzian function and a gaussian function.

פריטים שמוצגים בקובץ הזה

מוצג

היסטוריית הקובץ

ניתן ללחוץ על תאריך/שעה כדי לראות את הקובץ כפי שנראה באותו זמן.

תאריך/שעהתמונה ממוזערתממדיםמשתמשהערה
נוכחית00:11, 3 במאי 2019תמונה ממוזערת לגרסה מ־00:11, 3 במאי 2019‪460 × 610‬ (59 ק"ב)Cdanghalf variance; rounded values
17:40, 8 בנובמבר 2012תמונה ממוזערת לגרסה מ־17:40, 8 בנובמבר 2012‪364 × 483‬ (57 ק"ב)CdangUser created page with UploadWizard

אין בוויקיפדיה דפים המשתמשים בקובץ זה.

שימוש גלובלי בקובץ

אתרי הוויקי השונים הבאים משתמשים בקובץ זה:

מטא־נתונים