Meshgrid or other structure?
Show older comments
Is there any way I can code a meshgrid to get this type of data :

I'm trying to create a 2D 'table', I guess, where on the x axis, the values go from -96 to +96 by step of 4.
And the same on the Y axis, from -96 to +96 by step of 4.
I experimented with meshgrid, like this, but I'm not getting this result at all. Here's my code :
Axis_A = linspace(-96, 96, 49);
[x,y] = meshgrid(Axis_A,Axis_A);
I was considering using a loop but... that may be inefficient...
Accepted Answer
More Answers (1)
Axis_A = (-96:8:96)/2;
mgrid = Axis_A+Axis_A';
would give you that matrix.
As would
[x,y] = meshgrid(Axis_A);
mgrid = x+y;
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!