Question: Using control flow statements ( if / elseif / else statements ) , write a MATLAB code that tests the location of a given point

Using control flow statements (if/elseif/else statements), write a MATLAB code that tests the location of a given point P(xp,yp) on a two dimensional plane with respect to
an annular ring of inner radius Ri=1, outer radius Ro=2 centered at point C(xc,yc). Use the following center point coordinates xc=2,yc=3. In this problem, you will need to
report if the point P lies:
a. inside the annulus;
b. on the annulus;
c. beyond the outer radius;
d. within the annulus.
Below is a schematic drawing of the annular ring.
Question:
Test the following four points and assign their location (i.e., "inside", "outside", "on", "within the annulus") to the variable names loc_P1, loc_P2, loc_P3, and
loc_P4, respectively. The value assigned will be a string type, for example: loc_P1="within the annulus"
P1=(2,2.5)
P2=(2.6,4.2)
P3=(4,3)
P4=(8,10)
Hints:
You can calculate the distance between center point C and the points )=(1,2,3,4, then compare the value with the inner and outer radius.
The string-type variables are already defined for you to use. For example, the point P4 is beyond the outer radius, so you can use 2 loc_P4=c to assign the string value
"outside".Using control flow statements (if/elseif/else statements), write a MATLAB code that tests the location of a given point P(xp,yp) on a two dimensional plane with respect to
an annular ring of inner radius Ri=1, outer radius Ro=2 centered at point C(xc,yc). Use the following center point coordinates xc=2,yc=3. In this problem, you will need to
report if the point P lies:
a. inside the annulus;
b. on the annulus;
c. beyond the outer radius;
d. within the annulus.
Below is a schematic drawing of the annular ring.
Question:
Test the following four points and assign their location (i.e., "inside", "outside", "on", "within the annulus") to the variable names loc_P1, loc_P2, loc_P3, and
loc_P4, respectively. The value assigned will be a string type, for example: loc_P1="within the annulus"
P1=(2,2.5)
P2=(2.6,4.2)
P3=(4,3)
P4=(8,10)
Hints:
You can calculate the distance between center point C and the points )=(1,2,3,4, then compare the value with the inner and outer radius.
The string-type variables are already defined for you to use. For example, the point P4 is beyond the outer radius, so you can use 2 loc_P4=c to assign the string value
"outside".Using control flow statements (if/elseif/else statements), write a MATLAB code that tests the location of a given point P(xp,yp) on a two dimensional plane with respect to
an annular ring of inner radius Ri=1, outer radius Ro=2 centered at point C(xc,yc). Use the following center point coordinates xc=2,yc=3. In this problem, you will need to
report if the point P lies:
a. inside the annulus;
b. on the annulus;
c. beyond the outer radius;
d. within the annulus.
Below is a schematic drawing of the annular ring.
Question:
Test the following four points and assign their location (i.e., "inside", "outside", "on", "within the annulus") to the variable names loc_P1, loc_P2, loc_P3, and
loc_P4, respectively. The value assigned will be a string type, for example: loc_P1="within the annulus"
P1=(2,2.5)
P2=(2.6,4.2)
P3=(4,3)
P4=(8,10)
Hints:
You can calculate the distance between center point C and the points
Using control flow statements ( if / elseif /

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Civil Engineering Questions!