Second Derivative using diff
Ältere Kommentare anzeigen
I have a quick question concerning second derivatives using the diff function.
So, after I put in my x and y arrays I did
y1=diff(y)./diff(x)
I know that I have to change the length of y1 to take the second derivative. But I'm not sure in which order it should go. Should it be:
y1=[0 y1]
or
y1=[y1 0]
Then I would proceed to do
y2=diff(y1)./diff(x)
Any help is greatly appreciated! Thank you!
1 Kommentar
Victor Quezada
am 19 Mai 2020
Hi,
I'm coming from the future (from the coronavirus-age, actually). Sorry for being late.
Try: (just a suggestion)
diff(diff(y)./diff(x))./diff(x(1:length(x)-1))
or
diff(diff(y)./diff(x))./diff(x(2:length(x)))
Ciao.
Akzeptierte Antwort
Weitere Antworten (1)
Sanskruti Sawant
am 30 Jan. 2018
0 Stimmen
1/x
Kategorien
Mehr zu Digital Filtering 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!