Second Derivative using diff
古いコメントを表示
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 件のコメント
Victor Quezada
2020 年 5 月 19 日
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.
採用された回答
その他の回答 (1 件)
カテゴリ
ヘルプ センター および File Exchange で Digital Filtering についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!