• Remix
  • Share
  • New Entry

  • Ned Gulley

  • /
  • Sunset Time in Natick, Massachusetts

on 21 Nov 2023
  • 10
  • 16
  • 0
  • 1
  • 1793
drawframe(1);
Write your drawframe function below
function drawframe(f)
% Sunset time in Natick, Massachusetts
d = ["17-Nov-2023 16:24:13"
"18-Nov-2023 16:23:24"
"19-Nov-2023 16:22:36"
"20-Nov-2023 16:21:50"
"21-Nov-2023 16:21:06"
"22-Nov-2023 16:20:24"
"23-Nov-2023 16:19:45"
"24-Nov-2023 16:19:07"
"25-Nov-2023 16:18:32"
"26-Nov-2023 16:17:59"
"27-Nov-2023 16:17:28"
"28-Nov-2023 16:16:59"
"29-Nov-2023 16:16:32"
"30-Nov-2023 16:16:08"
"01-Dec-2023 16:15:46"
"02-Dec-2023 16:15:26"
"03-Dec-2023 16:15:09"
"04-Dec-2023 16:14:54"
"05-Dec-2023 16:14:41"
"06-Dec-2023 16:14:30"
"07-Dec-2023 16:14:22"
"08-Dec-2023 16:14:17"
"09-Dec-2023 16:14:13"
"10-Dec-2023 16:14:12"
"11-Dec-2023 16:14:14"
"12-Dec-2023 16:14:18"
"13-Dec-2023 16:14:24"
"14-Dec-2023 16:14:32"
"15-Dec-2023 16:14:43"
"16-Dec-2023 16:14:56"
"17-Dec-2023 16:15:12"
"18-Dec-2023 16:15:30"
"19-Dec-2023 16:15:50"
"20-Dec-2023 16:16:13"
"21-Dec-2023 16:16:37"
"22-Dec-2023 16:17:04"
"23-Dec-2023 16:17:34"
"24-Dec-2023 16:18:05"
"25-Dec-2023 16:18:39"
"26-Dec-2023 16:19:14"
"27-Dec-2023 16:19:52"
"28-Dec-2023 16:20:32"
"29-Dec-2023 16:21:14"
"30-Dec-2023 16:21:58"
"31-Dec-2023 16:22:43"
"01-Jan-2024 16:23:31"
"02-Jan-2024 16:24:20"
"03-Jan-2024 16:25:12"];
currentTime = datetime(d(f));
% Extract hours, minutes, and seconds from the current time
hours=hour(currentTime);
hours=mod(hours,12);
minutes=minute(currentTime);
seconds=second(currentTime);
% Draw clock design
cla
a=[4:12,1:3];
for i=1:12
polarplot([pi/6,pi/6]*i,[1.8,2],'LineWidth',4,'Color','k')
hold on
text(pi/6*i,1.5,num2str(a(i)),'FontSize',20,'HorizontalAlignment','center')
end
for i=1:60
polarplot([pi/30,pi/30]*i,[1.9 2],'LineWidth',2,'Color','k')
hold on
end
% Calculate angles for the clock hands
hourAngle=deg2rad(30*(hours+minutes/60)-90);
minuteAngle=deg2rad(6*(minutes+seconds/60)-90);
% Draw hour hand
polarplot([0,hourAngle],[0,1],'LineWidth',6,'Color','k');
% Draw minute hand
polarplot([0,minuteAngle],[0,1.3],'LineWidth',4,'Color','k');
% Set axis properties
ax=gca;
ax.RTickLabel={};
ax.ThetaTickLabel={};
ax.ThetaDir='clockwise';
% Set the background color of the figure to black
l=gcf;
l.Color='black';
% Turn off grid
grid off
% Display current time with timezone as title
title(char(currentTime)+" UTC",'Color','white','FontSize',13);
end
Animation
Remix Tree