A basic matlab problem

1 次查看(过去 30 天)
Hello all,
If I want to create a matrix of for example 9.5 with a specific size i.e. [9.5 9.5 .... 9.5], what should I do?
  2 个评论
Ashok jat
Ashok jat 2019-5-18
x=ones(1,8);
y=9.5*x
Walter Roberson
Walter Roberson 2019-5-19
This is the same as Fangjun Jiang's solution.

请先登录,再进行评论。

采纳的回答

Fangjun Jiang
Fangjun Jiang 2011-9-5
A=9.5*ones(3,4)

更多回答(4 个)

bym
bym 2011-9-5
m = 9.5*ones(1,15)

Walter Roberson
Walter Roberson 2011-9-5
A = repmat(9.5,3,4);
or
A(1:3,1:4) = 9.5;

Bao Le
Bao Le 2019-12-5
x = 9.5.*ones(2,5)

Alejandro Ayala
Alejandro Ayala 2019-12-5
x = 9.5.*ones(2,5)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by