编个例子你自己看一下
x = [1,2,3,4,5,6,7];
y = [2,3,3,5,7,21,43];
假设你已经有了
x,y的数据
那么
for i=1:length(x)-1
z(i) = (y(i+1)-y(i))/(x(i+1)-x(i));
end
c = abs(z(2:end))-abs(z(1:end-1));
[a,b] = max(c)
a是斜率变化最大值,b是对应的点
a是绝对值最大的斜率,b对应第几个节点斜率最大
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!