- The slope of the line from about 0 to about 0.5 ...
- The slope of the relatively linear descending part of the curve between about 1 and 3.75 ...
- The descending part of the loop ...
- The ascending part of the loop ...
Finding slope from a 2D plot
78 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have plotted a group of points using plot(x,y) command. The plot is non linear. I attached a picture with a line drawn on the linear side of the graph. Give me an idea of how to find the slope.

2 comentarios
Star Strider
el 7 de Dic. de 2014
Obvious question: Slope of what ?
Four possibilities:
... or something else?
Respuestas (1)
Image Analyst
el 7 de Dic. de 2014
I see 4 lines. Anyway, extract the x and y coordinates that you want to fit a line to, then use polyfit:
coefficients = polyfit(x, y, 1);
% Now get the slope, which is the first coefficient in the array:
slope = coefficients(1);
6 comentarios
Image Analyst
el 7 de Dic. de 2014
You can use
grid on;
or you can use line() to draw lines at certain, specific places.
xl = xlim();
yl = ylim();
% Draw quadrant dividing lines
xLine = (x(1)+x(2))/2;
yLine = (y(1)+y(2))/2;
% Draw vertical line
line([xLine, xLine], yl, 'Color', 'r', 'LineWidth', 2);
% Draw horizontal line.
line(xl, [yLine, yLine], 'Color', 'r');
Ver también
Categorías
Más información sobre Discrete Data Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

