The purpose of this assignment is to perform some elementary modeling
involving well-known trigonometric and geometric relations and to use
MATLAB to visualize the use of the model. The student will program an
elementary MATLAB script which will take user input, so some
elementary processing on that input, and produce and display a visual
result that is comprehensible.
Create a MATLAB script with the following characteristics:
Circle 1 radius> 5.78 Circle 2 radius> 10.3 Circle 3 radius> 4 Circle 4 radius> 8.1where numbers are entered by the user through a series of keystrokes involving keys '0' to '9' and '.' and ended by pressing the 'enter' key. Strings such as Circle 1 radius> are prompts that your script displays when it is ready to receive input for a circle.
![]() |
The coordinates of a point in the plane will be represented as a pair
where
is the horizontal displacement of the
point from the origin and
is the vertical displacement of the
point from the origin. If
is positive, the displacement is above
the origin and if
is negative, it is below. Similarly for
.
The origin has coordinates
. Let
be the radii of Circle 1, Circle 2, Circle 3, and
Circle 4, respectively. The coordinates of the center of Circle 1 are
then
and of the center of Circle 3
as shown. To find the coordinates of the centers we
must derive a relationship between their horizontal and vertical
displacements and the distances between centers, which are known
quantities.
This relationship may be derived easily with the help of
Figure 2 which shows a triangle with points
,
,
,
sides of length
,
,
, and base
. We need to determine
the value of unknowns
and
as a function of the knowns
,
,
. The expression we derive will be used to determine the
coordinates of the centers of Circles 2 and 4 since
,
, and
will be distances between centers (sums of radii).
By the theorem of Pythagoras,


To see how to use these results, consult Figure 3 where
the coordinates
of the center of Circle 2 are
found. Distance
(corresponding to
in the triangle of
Figure 2) is the sum of the radii of Circles 2 and 3 which
is
. Distance
(corresponding to
in the
triangle of Figure 2) is the sum of the radii of Circles 1
and 2 which is
. The distance between centers of Circles 1
and 3 (corresponding to
in the triangle of Figure 2)
is
. The distance corresponding to
in
Figure 2 is
. Therefore

The scripts in Figures 4 to 9 should be major hints in coding a solution to this problem. These scripts show how to draw lines and circles with given centers. The last figure shows how to obtain the center of circle 2. You will have to figure out how to obtain the center of circle 4.
Submit the single m file requested in Section 2 on or before April 13 using
blackboard. See the course webpage at
http://gauss.ececs.uc.edu/Courses/HTML/E112.html for instructions.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |