Create a Matrix with Specific Pattern for Changing Values

2 ビュー (過去 30 日間)
Allison Bushman
Allison Bushman 2019 年 4 月 16 日
回答済み: Kelly Kearney 2019 年 4 月 16 日
How can I create a matrix such as this one where the change in value is some dx and each column varies differently?
[-3*pi/4 -3*pi/4 -3*pi/4;
-3*pi/4 -3*pi/4 -3*pi/8;
-3*pi/4 -3*pi/4 0;
-3*pi/4 -3*pi/8 -3*pi/4;
-3*pi/4 -3*pi/8 -3*pi/8;
-3*pi/4 -3*pi/8 0;
-3*pi/4 0 -3*pi/4;
-3*pi/4 0 -3*pi/8;
-3*pi/4 0 0;
-3*pi/8 -3*pi/4 -3*pi/4;
-3*pi/8 -3*pi/4 -3*pi/8;
-3*pi/8 -3*pi/4 0;
-3*pi/8 -3*pi/8 -3*pi/4;
-3*pi/8 -3*pi/8 -3*pi/8;
-3*pi/8 -3*pi/8 0;
-3*pi/8 0 -3*pi/4;
-3*pi/8 0 -3*pi/8;
-3*pi/8 0 0;
0 -3*pi/4 -3*pi/4;
0 -3*pi/4 -3*pi/8;
0 -3*pi/4 0;
0 -3*pi/8 -3*pi/4;
0 -3*pi/8 -3*pi/8;
0 -3*pi/8 0;
0 0 -3*pi/4;
0 0 -3*pi/8;
0 0 0]

回答 (1 件)

Kelly Kearney
Kelly Kearney 2019 年 4 月 16 日
Create a grid of values, then unwrap:
xval = [-3*pi/4 -3*pi/8 0];
[a,b,c] = ndgrid(x,x,x);
x = [c(:) b(:) a(:)]

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by