Question

Design an analogue clock using Matlab. Designed using Matlab Instructions: 1. The clock you are designing...

Design an analogue clock using Matlab.
Designed using Matlab

Instructions:
1. The clock you are designing should have the same function as the real-life clock.

2. It has hour hand, minutes hand, second hand with different length.

3. The hour hand, minutes hand, second hand rotates clockwise direction.
4. It should have numbers 1-12 on the clock.

5. Hour hand fully rotate clockwise from 12 to 12 for 12 hour. Minute hand fully rotate clockwise from 12 to 12 for 60 minute. Second hand fully rotate clockwise from 12 to 12 for 60 seconds.

6. Include steps and thinking process in the scricpt using comment (%%).

7. Display date if possible. (Bonus Point)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

clc;clear;clf;
format shortg;
x=0;y=0;r=10;
hold on;
th = 0:pi/50:2*pi;
xunit = r * cos(th) + x;
yunit = r * sin(th) + y;
h = plot(xunit,yunit);
r=8; s=[1];
for th = pi/6: pi/6: 2*pi
ytemp = r * cos(th);
xtemp = r * sin(th);
text(xtemp,ytemp,num2str(s));
s = s+1;
end
while(1)
c = clock;
c = c(1,4:6);
min =c(1,2); sec=c(1,3);
if (c(1,1)>12)
hr = c(1,1)-12;
else
hr = c(1,1);
end
min1 = ceil(min/12);
theta = (hr*pi)/6 + (min1*pi)/30;
f=figure(1); hold on;
ytemp = 3 * cos(theta); Y = [0 ytemp];
xtemp = 3 * sin(theta); X = [0 xtemp];
p=plot(X,Y);hold on;
theta1 = (min*pi)/30;
ytemp1 = 5 * cos(theta1); Y1 = [0 ytemp1];
xtemp1 = 5 * sin(theta1); X1 = [0 xtemp1];
p1=plot(X1,Y1);
theta2 = (sec*pi)/30;
ytemp2 = 7 * cos(theta2); Y2 = [0 ytemp2];
xtemp2 = 7 * sin(theta2); X2 = [0 xtemp2];
p2=plot(X2,Y2);
pause(1);
delete(p2);
delete(p1);
delete(p);
end


- 5 x Pradeep - 0 X 56 Search Documentation Insert Tools Window EDITOR Figure 1 Insert B fx File Edit Comment % 99 o Indent 2

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Design an analogue clock using Matlab. Designed using Matlab Instructions: 1. The clock you are designing...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Design a way of using the pushbutton to trigger an interrupt to your system. Your system,...

    Design a way of using the pushbutton to trigger an interrupt to your system. Your system, upon receiving this interrupt, responds by reading and displaying the temperature in Fahrenheit degrees on the LCD display in the format of xxx.x. The system must resume displaying the digital clock. Build your circuit and include all the required information about your hardware design in your lab report. 4. Based on the hardware you designed, choose an interrupt/timer tool from mbed to update the...

  • For this project you will be writing up a simple Clock program to keep track of...

    For this project you will be writing up a simple Clock program to keep track of time. SimpleClock.java - contains your implementation of the SimpleClock class. You will need to provide the code for a constructor as well as the mutator methods set and tick and the accessor method toString. Look at the comments for each method to see how they should be implemented - the trickiest method is probably tick, which requires that you deal with the changing of...

  • MATLAB code help! Function Name: chemTimer Inputs: 1. (double) The current position of the hour hand 2. (double) The current position of the minute hand 3. (double) A positive or negative number of m...

    MATLAB code help! Function Name: chemTimer Inputs: 1. (double) The current position of the hour hand 2. (double) The current position of the minute hand 3. (double) A positive or negative number of minutes Outputs: 1. (double) The position of the hour hand after the specified time 2. (double) The position of the minute hand after the specified time Background: Oh no, you were running late to your Chem lab and completely forgot your reaction timer! It's a good thing...

  • Hey there, I am having a hard time using GUI for c# in visual studio. I...

    Hey there, I am having a hard time using GUI for c# in visual studio. I am making an alarm clock. I have a few questions that I would like to know how to do: --using a button called set time to capture text from a box containing a user-inputted hour, minute, second, and setting the current time to that. --using a button called alarm, Capture the Text in the TextBoxes - the Hours, Minutes, Seconds and Text (am/pm) and...

  • MATLAB Qla In the fib_clock.m file, write a function file that accepts the hour and minute values, and returns the logical vectors that indicate the appropriate Fibonacci numbers (1, 1, 2, 3, 5]...

    MATLAB Qla In the fib_clock.m file, write a function file that accepts the hour and minute values, and returns the logical vectors that indicate the appropriate Fibonacci numbers (1, 1, 2, 3, 5] to be used to represent the hours and minutes. Each Fibonacci number can only be used once. The following function file header is provided: function [fib_hour, fib minute] fib_clock(hour,minute) The hour variable needs to be an integer from 1 to 12 and the minute variable needs to...

  • HI C PROGRAMMING COULD YOU,, Rewrite the program to have it display the time on the...

    HI C PROGRAMMING COULD YOU,, Rewrite the program to have it display the time on the second line of the display, using the HH:MM:SS format. Use the 24-hour format for the hours, in other words, have the time go from 00:00:00 to 23:59:59. #include<LiquidCrystal.h> LiquidCrystal LcdDriver(11, 9, 5, 6, 7, 8); int minutes = 27; //These global integers keep the value of the clock int sec = 10; int hr = 10; const long interval = 1000; //This interval is...

  • Instructions: Refer to the Timel class provided in Figure 8.1 in your Deitel book to complete...

    Instructions: Refer to the Timel class provided in Figure 8.1 in your Deitel book to complete the exercise. Make sure that you follow the Program Style and Readability guidelines found in the Start Here Folder. 1. Write a Point class. The Point class should be written as an abstract data type. 2. Include the following instance variables: a. an integer representing the x coordinate b. an integer representing the y coordinate c. The instance variables in your program should only...

  • Using MATLAB. As an engineer working on designing and modelling a new drone product, you are...

    Using MATLAB. As an engineer working on designing and modelling a new drone product, you are doing a lot of different physics calculations. Your boss wants to write a program that can choose from an assortment of calculations and perform the desired physics calculation in order to streamline the design and modelling process. For this project you will write a function called PhysicsCalc. inputs Your function should take three inputs in the following order: var1–The first number in the calculation...

  • Lab Exercise #11 Assignment Overview You will work with a partner on this exercise during your la...

    help with cse problem Lab Exercise #11 Assignment Overview You will work with a partner on this exercise during your lab session. Two people should work at one computer. Occasionally switch the person who is typing. Talk to each other about what you are doing and why so that both of you understand each step Part A: Class Date . Download the files for this laboratory exercise, then run the Python shell and enter the following commands: >>>import date >>help(...

  • Programming Assignment 1 Write a class called Clock. Your class should have 3 instance variables, one...

    Programming Assignment 1 Write a class called Clock. Your class should have 3 instance variables, one for the hour, one for the minute and one for the second. Your class should have the following methods: A default constructor that takes no parameters (make sure this constructor assigns values to the instance variables) A constructor that takes 3 parameters, one for each instance variable A mutator method called setHour which takes a single integer parameter. This method sets the value of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT