Dividing Bounding box into equal parts

9 Ansichten (letzte 30 Tage)
Shweta Saboo
Shweta Saboo am 18 Mär. 2020
Beantwortet: Prabhan Purwar am 24 Mär. 2020
I have a bounding box of dimensions [x y width height]. I want to divide this rectangle into 16 equal rectangles or squares of equal dimensions.
  1 Kommentar
darova
darova am 18 Mär. 2020
What difficulties do you have? What is the question?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Prabhan Purwar
Prabhan Purwar am 24 Mär. 2020
Hi,
Following code may help:
clc
close all
clear
% bounding box [x y width height]
%Assuming (x,y) represents a starting point located at the bottom left corner of the box (In XY Plane).
x=0;
y=0;
width=16;
height=16;
subparts=16; %No of equal parts (Must be a perfect square)
n=sqrt(subparts)+1;
xb=linspace(x,x+width,n);
yb=linspace(y,y+height,n);
[X,Y]=meshgrid(xb,yb);
surf(X,Y,zeros(n))
Output:
For further information refer to the following links:

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by