Since you are new, let us show you how Trendy works.

Close-button

Plot for Number of Followers for MATLAB on Google+

This plot is broken.

Error using dateformverify (line 18)
DATESTR failed converting date number to date vector.  Date number out of range.

Error in datestr (line 195)
S = dateformverify(dtnumber, dateformstr, islocal);
  • Created by: Toshiaki Takeuchi
  • Latest result: Error using dateformverify (line 18) DATESTR failed converting date number to date vector. Date number out of range. Error in datestr (line 195) S = dateformverify(dtnumber, dateformstr, islocal);
  • Created on: 04 Feb 2012
  • Liked: 3 times

This plot shows the growth of followers for MATLAB page on Google+. It then fits a linear trend line and predicts the number of the followers on the next day.

Since the plot is just a PNG image file and it gets updated automatically on a daily basis, you can embed the plot on your blog or wiki by using HTML img tag. i.e.<img src="http://www.mathworks.com/matlabcentral/trendy/images/plots/plot_706.png">

Give it a try!

Plot Image
% time1493 and data1493 available for use
% for MATLAB news on Google+ from Topsy
% 
% This plot shows the growth of followers for MATLAB page on Google+. 
% It then fits a linear trend line and predicts the number of the followers on the next day.
% Since the plot is just a PNG image file and it gets updated automatically on a daily basis, you can embed the plot on your blog or wiki by using HTML img tag.
% Give it a try!

% Number of Followers for MATLAB on Google+
%   time vector is: time1305
%   data vector is: data1305

% Starting date for prediction
% t0 = datenum('22-Feb-2012');
% keep = time1305 >= t0;
% 
% tm = time1305(keep);
% dm = data1305(keep);

tm = time1305(:)';
dm = data1305(:)';

% Fit MATLAB Follower growth
[p,S,mu] = polyfit(tm,dm,1);
p1 = [p(1)/mu(2) p(2)-p(1)*mu(1)/mu(2)];

% Project into the future
tf = [tm tm(end)+1];
df = polyval(p1,tf);

% Predict the number for the next day
d=round(df(end));
t=datestr(tm(end)+1,1);
next=sprintf('Prediction for %s: %d followers',t,d);

% Predict when it will reach a goal
goal = 1500;
g = sprintf('Will reach %d followers on ', goal);
reach = [g datestr((goal - p1(2))/p1(1),1)];

% Was previous prediction correct?
[p,S,mu] = polyfit(tm(1:end-1),dm(1:end-1),1);
p2 = [p(1)/mu(2) p(2)-p(1)*mu(1)/mu(2)];
prev = polyval(p2,tm(end-1)+1);
prev = round(prev);
gap = prev-dm(end);
t=datestr(tm(end),1);
prevp=sprintf('Prev Prediction for %s off by %d',t,gap);

% trend up to the shift
% tn = time1305(~keep);
% dn = data1305(~keep);
% [p,S,mu] = polyfit(tn,dn,1);
% p3 = [p(1)/mu(2) p(2)-p(1)*mu(1)/mu(2)];
% tf = [tn tf];
% df = [polyval(p3,tn) df];

% Plot the data and trend
% subplot(2,1,1)
  plot(time1305,data1305, '-');
  hold on
  line(tf,df,'Color','magenta','LineStyle','-')
  plot(tm(end),prev, 'ro');
  hold off
  datetick
  title('Number of Followers for MATLAB page on Google+')
  legend('Followers','Trend','Prev Prediction', 'Location', 'Best')

  % Get normalized position for annotation
  yrange = ylim;
  ymin = yrange(1);
  ymax = yrange(2);
  YPos1 = ymin+0.95*(ymax-ymin);
  YPos2 = ymin+0.90*(ymax-ymin);
  YPos3 = ymin+0.85*(ymax-ymin);

  % Add the predictions
  text(time1305(1),YPos1,next)
  text(time1305(1),YPos2,prevp)
  text(time1305(1),YPos3,reach)

%  subplot(2,1,2)
%    gap = length(time1305)-length(time1493)
%    padding=repmat([NaN],1,gap);
%    plot([time1305(1:gap) time1493], ...
%      [padding data1493], 'o-');
%    datetick
%  title('MATLAB mentions on Google+ per Topsy')
Tags:

Add Tags


0 comments