3-d order derivative
Ältere Kommentare anzeigen
Dear all,
there is the following problem with the calculation of a 3-d order derivative.
I have two vectors of lambda and refractive index, respectively. I take the 3-d order derivative using a gradient().
dndl=gradient(n)./gradient(lambda);
d2ndl2=gradient(dndl)./gradient(lambda);
d3ndl3=gradient(d2ndl2)./gradient(lambda);
When I use a relatively small number of points (for example 3000) , I get a smooth plot.

In the case of more points (30 000) there is some oscillation in the plot.

What is the reason of such behavior?
Thank you a lot.
2 Kommentare
Matt J
am 13 Feb. 2022
What do you mean by "use more points"? If it's a different input array why expect the same results?
Max Demesh
am 13 Feb. 2022
Antworten (3)
Catalytic
am 13 Feb. 2022
1 Stimme
If the points are too close together, the difference between neighbours will be so small as to be dominated by floating point errors
1 Kommentar
Max Demesh
am 13 Feb. 2022
Matt J
am 13 Feb. 2022
0 Stimmen
You could try diff(x,3)
2 Kommentare
Max Demesh
am 14 Feb. 2022
Matt J
am 14 Feb. 2022
Why care whether its forward or central? For a smooth curve, it should work out the same.
Max Demesh
am 14 Feb. 2022
0 Stimmen
Kategorien
Mehr zu Linear Algebra finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!