Info

此问题已关闭。 请重新打开它进行编辑或回答。

If I have many figures, how can I find a slope for each one and compare between thier slope?

1 次查看(过去 30 天)
I need to check which plot is steepest? I used polyfit to fit a curve and find a gradient but I do not know how to compare between figures slope.
  1 个评论
Thorsten
Thorsten 2015-10-19
It is not clear what you want to achieve. Please provide an example in Matlab, showing what you have done so far and what you want to do.

回答(2 个)

Image Analyst
Image Analyst 2015-10-19
The gradient is the slope, so you have everything you need. For example if you fit a line
coefficients1 = polyfit(x1, y1, 1);
slope1 = coefficients1(1);
coefficients2 = polyfit(x2, y2, 1);
slope2 = coefficients2(1);
% Now compare
if slope1 > slope2
% Take some action.....
end

Avan Al-Saffar
Avan Al-Saffar 2015-10-19
The attached file is my code.
I've found a curve fit and gradient but I do not know how to decide which figure is steepest, can you help me with this point please?

Community Treasure Hunt

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

Start Hunting!

Translated by