לדלג לתוכן

קובץ:Detection pic savitzky Golay.svg

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

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

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

תקציר

תיאור
English: Peak detection using the Savitzky-Golay smoothing and derivation algorithm. The peak width is given by the local extrema of the first derivative. The peak position is given by the local minima of the second derivative.
Français : Détection de pics par l'algorithme de lissage et de dérivation de Savitzky-Golay. La largeur des pics est donnée par les extrema locaux de la dérivée première. La position des pics est donnée par les minima locaux de la dérivée seconde.
תאריך יצירה
מקור נוצר על־ידי מעלה היצירה; created with Scilab, processed with Inkscape (addition of the dashed lines).
יוצר Christophe Dang Ngoc Chan(cdang)
גרסאות אחרות File:Desommation trois pics gaussiens 21pts.svg (stronger filtering: width = 21 points)

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 three_gaussian_peaks_generator.sce : creates a data set and saves it in the three_gaussian_peaks.txt file. Similar to File:Detection pic derivee seconde.png.


clear;
chdir('mypath/')

// Parameters of the function
 
step = 0.02;
X = [0:step:10]';
speak = 0.1; // sigma peaks
varnoise = 0.01; // variance of the noise
 
// Gauss function
 
function [y]=gauss(x, sigma)
   y=1/(sqrt(2*%pi*sigma))*exp(-x^2/(2*sigma));
endfunction
 
// global function
 
function [y]=f(x, sigma, variancenoise)
    for i = 1:size(x,'*')
        y (i) = gauss(x(i) - 2, sigma) + 0.5*gauss(x(i) - 6.2, sigma)...
        + gauss(x(i)-7, sigma) + variancenoise*rand(1,'normal');
    end
endfunction
 
// Data generation

Y = f(X, speak, varnoise);

// plot(X,Y);

// Saving

write('three_gaussian_peaks.txt', [X,Y]);

File savitztygolay.sce: processes the data. Similar to File:Savitzky-golay pic gaussien bruite.svg (see this page if the sampling step is not constant).

// **********
// Constants and initialisation
// **********

clear;
clf;
chdir('mypath/')

// smoothing parameters :
width = 9; // width of the sliding window (number of pts)
poldeg = 3; // degree of the polynomial

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

// Convolution coefficients

function [a]=convolcoefs(m, d)
    // m : width of the window
    // d : degree of the polynomial
    l = (m-1)/2; // half-width of the window
    a = ones(3,m);
    z = (-l:l)'; // standardised abscissa
    J = ones(m,d+1);
    for i = 2:d+1
        J(:,i) = z.^(i-1); // jacobian matrix
    end
    A = (J'*J)^{-1}*J';
    a = A(1:3,:);
endfunction

// smoothing, determination of the first and second derivatives

function [y, yprime, ysecond] = savitzkygolay(X, Y, wdt, deg)
    // X, Y: collection of data
    // wdt: width of the window
    // deg : degree of the polynomial
    n = size(X,'*');
    l = floor(wdt/2);
    step = (X($) - X(1))/(n - 1);
    y=Y;
    yprime = zeros(Y);
    ysecond = yprime;
    a = convolcoefs(wdt, deg);
    a(2,:) = 1/step*a(2,:);
    a(3,:) = 2/step^2*a(3,:);
    for i=(l+1):(n-l)
        y(i) = a(1,:)*Y(i-l:i+l);
        yprime(i) = a(2,:)*Y(i-l:i+l);
        ysecond(i) = a(3,:)*Y(i-l:i+l);
    end
endfunction

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

// data reading

data = read('three_gaussian_peaks.txt', -1, 2)
Xinit = data(:,1);
Yinit = data(:,2);

//subplot(3,1,1)
//plot(Xdef, Ydef, "b")

// Data processing

[Ysmooth, Yprime, Ysecond] = savitzkygolay(Xinit, Yinit, width, poldeg);

// Display

offset = floor(width/2);
nbpts=size(Xinit,'*');
X1=Xinit((offset+1):(nbpts-offset));
X2=Xinit((2*offset+1):(nbpts-2*offset));
Y1=Yprime((offset+1):(nbpts-offset));
Y2=Ysecond((2*offset+1):(nbpts-2*offset));

subplot(3,1,1)
plot(Xinit, Yinit, "b")
plot(Xinit, Ysmooth, "r")

subplot(3,1,2)
plot(X1, Y1, "b")

subplot(3,1,3)
plot(X2, Y2, "b")

רישיון

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

כיתובים

נא להוסיף משפט שמסביר מה הקובץ מייצג

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

מוצג

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

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

תאריך/שעהתמונה ממוזערתממדיםמשתמשהערה
נוכחית16:08, 12 בנובמבר 2012תמונה ממוזערת לגרסה מ־16:08, 12 בנובמבר 2012‪460 × 610‬ (69 ק"ב)Cdang{{Information | description = {{en|1=Peak detection using the Savitzky-Golay smoothing and derivation algorithm. The peak width is given by the local extrema of the first derivative. The peak position is given by the local minima of the second derivati...

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

מטא־נתונים