Filter löschen
Filter löschen

How to take the fourth derivative of a reflectance graph

1 Ansicht (letzte 30 Tage)
Erin Browne
Erin Browne am 21 Mär. 2019
Kommentiert: Torsten am 27 Mär. 2019
Hi I am looking to calculate and plot the fourth derivtative of a reflectance plot for coral spectra - commonly done in papers by the savistky and golay, 1964 method.
I have used the smoothing function on my coral mean spectra (x3) (1st image)
S2 = smooth(S1);
plot(wv1, S2);
xlim([400 750])
Then went to take my 1st derivative (2nd image)
This turned out ok using this coding:
dy = diff(S2)/diff(wv1);
plot(wv1(2:end),dy)
xlim([400 750])
But I believe this is the wrong method for taking the derivative of the reflectance spectra as I loose data going fromm 1446x1 to 1445x1 each time i derive i.e.
taking the second derivative like so:
d2ydx2 = diff(dy)./diff(wv1);
plot(wv1(1:1444),d2ydx2)
xlim([400 750])
producing a graph like image 3 - which when it comes to the 4th i have lost nearly all the data (image 4)
Does anyone know where I am going wrong, as this must be much more straight forward given it has been used so frequently.
Thanks

Akzeptierte Antwort

Torsten
Torsten am 21 Mär. 2019
If you have the signal processing toolbox licenced, use "sgolay" and "sgolayfilt".
Or download from the file exchange:
https://de.mathworks.com/matlabcentral/fileexchange/30299-savitzky-golay-smooth-differentiation-filters-and-filter-application
  4 Kommentare
Erin Browne
Erin Browne am 26 Mär. 2019
thanks for the help!
I've found that this method isn't working as my data is in 1nm and due to the fact it is going up and down so close together when taking any avergaing method it loses the quite obvious peaks, if you understand what im trying to say.
I believe binning into coarser resolutions may help?
Torsten
Torsten am 27 Mär. 2019
I think trying to determine the 4th derivative of such data is quite a challenge, not to say quite impossible in my opinion.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by