Clear Filters
Clear Filters

how to control the grid size and scale?

57 views (last 30 days)
taetae
taetae on 5 Aug 2024 at 2:54
Answered: Rahul Chowdhury on 5 Aug 2024 at 5:57
I had a grid size of 200 * 200, but I wanted to increase the resolution, so I changed it to 400 * 400. Of course, 1 grid square means 1m.
However, when I increased the size to 400, I found out that there were some structural problems in subsequent calculations.
So I want to maintain the grid size at 200 * 200, but adjust the scale so that one square means 0.5m,
and there are no problems in subsequent calculations.
Below is the current code.
originalnewGridSize = 200;
newGridSize = 400;
[x, y] = meshgrid(linspace(1, originalnewGridSize, newGridSize), linspace(1, originalnewGridSize, newGridSize));

Accepted Answer

Rahul Chowdhury
Rahul Chowdhury on 5 Aug 2024 at 5:57
I don't fully understand what your question is, but I can provide some ideas for you:
The first step would be to understand how the linspace command works. Quickly stated, linspace(x1, x2, n) returns a vector that starts at x1 and ends at x2 with n number of points. You can find the spacing between the points with the formula (x2-x1)/(n-1). Assuming you want to start at 1, end at 200 and have a spacing of 0.5, it should look like this:
linspace(1, 200, 399)
Another thing you could try is looking at the scaledMesh documentation to see if it's applicable for you.

More Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!