how to find the local Slope of a curve in each point
11 ビュー (過去 30 日間)
古いコメントを表示
how to calculate the local slope degree of this curve in its point having the x and y values of the curve:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/145505/image.png)
I tried to do it with the following :
slope = diff(y) ./ diff(x);
or :
slopeY = (y(2:end) + y(1:end-1))/2;
but my results doesnt seem to be correct. Thank you.
2 件のコメント
Adam
2014 年 9 月 24 日
In what way do the results not seem correct? Do you have manually calculated results that differ?
Star Strider
2014 年 9 月 24 日
I would use gradient rather than diff, since the output vector is the same length as the input vector.
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!