How do I compute the second derivative of a one-dimensional array?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
42 replies · 5K views
Physics news on Phys.org
btb4198 said:
So Basically to take the first derivative, I am going to go through the array and subtract index + 1 from index.
So:
double value = spectrumData[i + 1] - spectrumData;
You need to get your units right in your derivative calculations (both for the numerator and denominator). The units for the numerator look to be "counts" right? And for the denominator, you have bins separated by some delta-energy in keV? So the units of the first derivative would be delta-counts per delta keV?
 
berkeman said:
So the units of the first derivative would be delta-counts per delta keV?
It looks like the horizontal bins are spaced linearly? What is the increment in delta-keV per bin? It looks like a small fraction of a keV delta per bin?
 
berkeman said:
You need to get your units right in your derivative calculations (both for the numerator and denominator). The units for the numerator look to be "counts" right? And for the denominator, you have bins separated by some delta-energy in keV? So the units of the first derivative would be delta-counts per delta keV?
Yes, that is all correct.
 
berkeman said:
It looks like the horizontal bins are spaced linearly? What is the increment in delta-keV per bin? It looks like a small fraction of a keV delta per bin?
1655149886661.png


From this picture is looks like the bins increase by one .
 
Another question, if I were to place this Spectrum into an FFT would my sampling rate(fs) be 1hz ?
 
btb4198 said:
From this picture is looks like the bins increase by one .
One what? One eV? Could be -- please take care to always include units with the numbers. Thank you.
 
btb4198 said:
From this picture is looks like the bins increase by one .
I don't think so. The increments along the horizontal axis (eV) increase by 2000 eV. Since you're attempting to find an approximation to the derivative, is your math background sufficient for you to understand what you're trying to do? That is, have you taken calculus sometime in the past?
 
  • Like
Likes   Reactions: berkeman
btb4198 said:
Another question, if I were to place this Spectrum into an FFT would my sampling rate(fs) be 1hz ?
No. You already have a plot of counts per fraction-of-an-eV. What domain do you want the FT to transform that into? You can't randomly do FFT processing on data and get meaningful information.
 
berkeman said:
No. You already have a plot of counts per fraction-of-an-eV. What domain do you want the FT to transform that into? You can't randomly do FFT processing on data and get meaningful information.
In the example excel file, could you put that into an FFT? Or no ?
anyhow, The Output of the DPP is Very noise, so I wanted to filter out the noise.
 
btb4198 said:
In the example excel file, could you put that into an FFT? Or no ?
anyhow, The Output of the DPP is Very noise, so I wanted to filter out the noise.
Your thread is now temporarily locked. I will send you a Private Message (PM) in a few minutes to try to salvage it.
 
After the PM discussion with the OP, there is no reason to re-open this thread. Thanks everybody for trying to help the OP out.