how to control the grid size and scale?

10 visualizzazioni (ultimi 30 giorni)
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));

Risposta accettata

Rahul Chowdhury
Rahul Chowdhury il 5 Ago 2024
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.

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by