Analogue Clock Using MATLAB

P. Manickaraja

6
23902

NASA might get a fancy digital-count display, retire the analogue clock from Apollo era but the passion for the analogue clock does not end. An analogue clock has moving hands, where the smaller one is the hours hand and travels 30° in one hour, and the longer one is the minutes hand and travels 360° in an hour. The seconds hand rotates with a step of 6°.

F25_Fig
Screenshot of the program output

Software program
The coding is developed using MATLAB version 7.9.0.529 (or R2009b). MATLAB has a good collection of graphics commands for plotting and analysing complex signals. The built-in functions reduce the size of the program and provide the desired output.

Program logic. Circle with a radius of 10 units is drawn. Hours are marked from 1 to 12, 30° apart. System time such as your PC’s is read by the command. According to the current time of your PC, the hours, minutes and seconds hands are displayed.

Download source code: click here

Commands used. The figure shows the screenshot of the program output. Commands used in the program for the analogue clock display are given below:
clock( ). This command extracts date, year and current time from the real-time system.
pause ( ). It provides the required time delay in seconds.
clc( ). It clears the command window.
clear( ). It clears all variables.
textxy ( ). This command prints the text in the specified location, which is mentioned as x and y coordinates.
numtostr( ). It converts a number to string data type.


P. Manickaraja is masters in engineering in control and instrumentation from College of Engineering, Guindy, Tamil Nadu

6 COMMENTS

    • Hi Ferdoos, Please refresh the page or check your interne connection. We have checked from our side and there is no problem in downloading the source file.

LEAVE A REPLY

Please enter your comment!
Please enter your name here