I have a data A,B and I want to calculate the slope between two existing points
I want to find the slop between 2012 & 2013 points I try:
A=[ 234228; 249150 ; 265021 ;281904 ;299862 ];B=[ 7380; 8045 ; 9903 ;15058 ;13610 ];plot(A,B);a = [2010:2014]'; b = num2str(a); c = cellstr(b);dx = 1; dy = 1; % displacement so the text does not overlay the data points
text(A+dx, B+dy , c)hold oncoefficients = polyfit(A, B, 1);slope = coefficients(1);text(266000,11500,num2str(slope,'y = %.3fx'))
but it seems to be wrong š ANY IDEA
Best Answer