Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 - D Area Using MATLAB Imagine that you are given a collection of k boxes on the ( x , y ) - plane,
D Area Using MATLAB
Imagine that you are given a collection of boxes on the plane, assumed to have their sides aligned with the axes; an example with 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 inputbox. This will consist of rows, one for each box, each with entries to describe the corners of that box: the smallest value, the largest value, the smallest value, and the largest value, respectively. For example, the data for the boxes shown above would be
for the blue, black, and red boxes, in order.
At the end of your program you should have created the solution variable myarea, a scalar containing the resulting area. For the example this area is
The test files, areatestmat and areatestmat contain sample inputs for testing. The first of these three nonoverlapping boxes with total area of ; the second has a simple overlap so that the final area is
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started