Homework Help Question & Answers

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
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 Coin

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
Free Homework 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.