how to find the local Slope of a curve in each point

조회 수: 12 (최근 30일)
Dimitrios
Dimitrios 2014년 9월 24일
편집: Dimitrios 2014년 9월 24일
how to calculate the local slope degree of this curve in its point having the x and y values of the curve:
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
Adam 2014년 9월 24일
In what way do the results not seem correct? Do you have manually calculated results that differ?
Star Strider
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개)

the cyclist
the cyclist 2014년 9월 24일
One possibility is to use the movingslope function from the File Exchange.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by