Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 - D Area Using MATLAB Imagine that you are given a collection of k boxes on the ( x , y ) - plane,

2-D Area Using MATLAB
Imagine that you are given a collection of k boxes on the (x,y)-plane, assumed to have their sides aligned with the axes; an example with k=3 appears to the right. The goal for this problem is to compute the total area covered by the union of the boxes, without counting any overlap more than once.
Write a program to compute the area with the following syntax:
The information about the boxes are contained in the variable input_box. This will consist of k rows, one for each box, each with 4 entries to describe the 4 corners of that box: the smallest x value, the largest x value, the smallest y value, and the largest y value, respectively. For example, the data for the boxes shown above would be
[0402261335-11.5]
for the blue, black, and red boxes, in order.
At the end of your program you should have created the solution variable my_area, a scalar containing the resulting area. For the example this area is 17.
The test files, area_test_1.mat and area_test_2.mat contain sample inputs for testing. The first of these three non-overlapping boxes with total area of 14; the second has a simple overlap so that the final area is 7.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions