How do i make a matrix like this

3 次查看(过去 30 天)
I'm trying to make a matrix with two columns. The second column is from .5 to 20 with .1 increments and i want the first column to have .5 for as many rows the second column gives, but I also want this to happen for .6, .7, .8, .9, 1, 1.1,... and all the way up to 20 with .1 increments in the same matrix.
i put a picture of a small portion for what i'm talking about.

采纳的回答

Walter Roberson
Walter Roberson 2018-4-29
[C1, C2] = ndgrid(0.5:.1:20);
matrix = [C1(:), C2(:)];
  3 个评论
KALYAN ACHARJYA
KALYAN ACHARJYA 2018-4-29
编辑:KALYAN ACHARJYA 2018-4-29
Are you getting the result as per your requirement? The answer is interesting, that's why I have checked it, I got the result as follows-
Walter Roberson
Walter Roberson 2018-4-29
You can replace ndgrid() with meshgrid() to get the values in the other order.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by