how to control the grid size and scale?
56 次查看(过去 30 天)
显示 更早的评论
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));
采纳的回答
Rahul Chowdhury
2024-8-5,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.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!