Also calculate the rate at which it's growing.
% Files on the File Exchange
% time vector is: time1151
% data vector is: data1151
data1151 = data1151(:);
% Pick 180 days worth of data
t0 = now - 180;
goal = 20;
pick = time1151 > t0;
t = time1151(pick);
d = data1151(pick)/1000;
plot(t,d,'b')
[p,S,mu] = polyfit(t,d,1);
% p1 is the equation for the linear fit to the data
p1 = [p(1)/mu(2) p(2)-p(1)*mu(1)/mu(2)];
% p2 is the equation for the target amount
p2 = [0 goal];
% ti = t_intersect, di = d_intersect
ti = (p2(2) - p1(2))/(p1(1)-p2(1));
di = p1(1)*ti + p1(2);
tf = [t0 ti+1];
df = polyval(p1,tf);
line(tf,df,'Color','red','LineStyle',':')
line([t0 ti+1],goal*[1 1],'Color','black')
line(ti,di,'Marker','o','Color','red')
set(gca,'FontSize',16)
datetick
title(sprintf('The File Exchange is growing by %4.1f files/day', 1000*p1(1)))
xlabel(sprintf('20,000 files on %s', datestr(ti)))
ylabel('Number of Files (1000s)')
data points
Created 18 Oct 2011 by Ned Gulley (1 Like)
189 views (30 days)
This trend is associated in this plot (though may not be used.)
0 comments