フィルターのクリア

Meshgrid or other structure?

3 ビュー (過去 30 日間)
Roger Breton
Roger Breton 2022 年 1 月 22 日
コメント済み: Roger Breton 2022 年 1 月 22 日
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...

採用された回答

Stephen23
Stephen23 2022 年 1 月 22 日
Simpler:
M = hankel(-96:4:96)
M = 49×49
-96 -92 -88 -84 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 -92 -88 -84 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 -88 -84 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 -84 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 32 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 32 36 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 32 36 40 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 32 36 40 44 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 32 36 40 44 48 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 32 36 40 44 48 52 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 32 36 40 44 48 52 56
  1 件のコメント
Roger Breton
Roger Breton 2022 年 1 月 22 日
Wow! Thank you!!

サインインしてコメントする。

その他の回答 (1 件)

Chris
Chris 2022 年 1 月 22 日
編集済み: Chris 2022 年 1 月 22 日
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;
  2 件のコメント
Roger Breton
Roger Breton 2022 年 1 月 22 日
Wow! Thank you!
Roger Breton
Roger Breton 2022 年 1 月 22 日
I should accept this answer too :-)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by