Second Derivative using diff
Mostrar comentarios más antiguos
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 comentario
Victor Quezada
el 19 de Mayo de 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.
Respuesta aceptada
Más respuestas (1)
Sanskruti Sawant
el 30 de En. de 2018
0 votos
1/x
Categorías
Más información sobre Digital Filtering en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!