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);
"Total Views" and "likes" from Solving a Sudoku Puzzle Using a Webcam by Teja on YouTube and track its growth.
このビデオには 日本語バージョン もあります。
% time1383 and data1383 available for use
% for Total likes of Teja's Webcam Sudoku Solver video on YouTube
%
% Total views of Teja's Webcam Sudoku Solver video on YouTube
% time vector is: time1382
% data vector is: data1382
subplot(2,1,1)
% Fit the growth of total views
[p,S,mu] = polyfit(time1382,data1382,1);
p1 = [p(1)/mu(2) p(2)-p(1)*mu(1)/mu(2)];
% Project into the future
tf = [time1382; time1382(end)+1];
df = polyval(p1,tf);
% Predict the number for the next day
d=round(df(end));
t=datestr(time1382(end)+1,1);
s=sprintf('Prediction for %s: %d followers',t,d);
% Predict when it will reach a goal
goal = 8000;
g = sprintf('Will reach %d views on ', goal);
g = [g datestr((goal - p1(2))/p1(1),1)];
% Was previous prediction correct?
[p,S,mu] = polyfit(time1382(1:end-1),data1382(1:end-1),1);
p2 = [p(1)/mu(2) p(2)-p(1)*mu(1)/mu(2)];
prev = polyval(p2,time1382(end-1)+1);
prev = round(prev);
gap = prev-data1382(end);
t=datestr(time1382(end),1);
p=sprintf('Prev Prediction for %s off by %d',t,gap);
% Plot the data and trend
plot(time1382,data1382, '-');
hold on
line(tf,df,'Color','magenta','LineStyle','-')
plot(time1382(end),prev, 'ro');
datetick
title('Total views of Teja''s Sudoku video')
legend('Total Views','Trend','Prev Prediction', 'Location', 'Northwest')
xlabel(s)
hold off
% Get normalized position for annotation
xrange = xlim;
xmin = xrange(1);
xmax = xrange(2);
yrange = ylim;
ymin = yrange(1);
ymax = yrange(2);
% Add the prediction
XPos = xmin+0.35*(xmax-xmin);
YPos1 = ymin+0.2*(ymax-ymin);
YPos2 = ymin+0.1*(ymax-ymin);
text(XPos,YPos1,p)
text(XPos,YPos2,g)
subplot(2,1,2)
% Adjust the Y axis
ymin = fix(min(data1383));
ymax = ceil(max(data1383));
plot(time1383,data1383, '-');
datetick
title('Total likes of Teja''s Sudoku video')
ylim([ymin-1 ymax+1])
set(gca,'YTick',ymin-1:ymax+1)
data points
Created 06 Feb 2012 by Toshiaki Takeuchi
54 views (30 days)
This trend is associated in this plot (though may not be used.)
data points
Created 06 Feb 2012 by Toshiaki Takeuchi
98 views (30 days)
This trend is associated in this plot (though may not be used.)
0 comments