Write a function rect = rect_aperture(r1, c1, r2, c2) that constructs a rectangular aperture on a 512x1024 grid, where the top-left corner of the rectangle has row, column coordinates r1, c1 and the bottom-right corner has coordinates r2, c2

2 views (last 30 days)
This is a homework question I have, not really sure how to go about doing it, can someone please help? Here is the additional information for the question.
An aperture can be simulated in MATLAB as a 2D array, by putting a 1 at every point where light can come
through and a 0 everywhere else.
Hint: you can use array slice notation of the form A(r1:r2,c1:c2) to select the rectangular region bounded
between rows r1 and r2, and columns c1 and c2 (inclusive) within the array A.
Test out this function by using it to generate a rectangular aperture 20 pixels high and 100 pixels wide. The top
left corner should be at row, column coordinates of (247, 463). This corresponds to the rectangle being roughly at
the centre of the grid.
T

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!