A basic matlab problem

1 visualizzazione (ultimi 30 giorni)
Bahareh
Bahareh il 5 Set 2011
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 Commenti
Ashok jat
Ashok jat il 18 Mag 2019
x=ones(1,8);
y=9.5*x
Walter Roberson
Walter Roberson il 19 Mag 2019
This is the same as Fangjun Jiang's solution.

Accedi per commentare.

Risposta accettata

Fangjun Jiang
Fangjun Jiang il 5 Set 2011
A=9.5*ones(3,4)

Più risposte (4)

bym
bym il 5 Set 2011
m = 9.5*ones(1,15)

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

Bao Le
Bao Le il 5 Dic 2019
x = 9.5.*ones(2,5)
  1 Commento
Walter Roberson
Walter Roberson il 5 Dic 2019
This is the same as earlier solutions.

Accedi per commentare.


Alejandro Ayala
Alejandro Ayala il 5 Dic 2019
x = 9.5.*ones(2,5)
  1 Commento
Walter Roberson
Walter Roberson il 5 Dic 2019
This is the same as earlier solutions.

Accedi per commentare.

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by