How to form a matrix as our requirements??????

1 visualización (últimos 30 días)
VIJAY
VIJAY el 25 de Abr. de 2020
Comentada: VIJAY el 26 de Abr. de 2020
Hello
I wanna create a matrix as size is 50rows 6 columns.The sum of each row is 100. the value limits is 0 to 100 its may be float value .For example of one row is
[20 40 10 5 5 20]

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 25 de Abr. de 2020
x = rand(50, 6);
x = x./sum(x,2)*100;
Result
>> sum(x,2)
ans =
100.0000
100.0000
100.0000
..
..
..
100.0000
100.0000
  4 comentarios
Ameer Hamza
Ameer Hamza el 26 de Abr. de 2020
This is already in quite the simplest form. Any further simplification can only be done by defining your own function.
VIJAY
VIJAY el 26 de Abr. de 2020
Ok sir thanks for your kind reply

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by