Random Vector in decreasing order

2 visualizaciones (últimos 30 días)
Berkay
Berkay el 29 de Ag. de 2022
Respondida: Matt J el 29 de Ag. de 2022
I want to create the random column vector with 15 elements, they should be listed in decreased order.
I can create a random clumn vector and then I can sort it in decreased order but is it possible to create it sorted.

Respuesta aceptada

Matt J
Matt J el 29 de Ag. de 2022
There are alternatives to post-sorting, e.g. below, but no randomization function that will just spit out a sorted list.
cumsum(rand(15,1),'reverse')
ans = 15×1
7.5705 6.8873 6.2822 5.6986 5.0179 4.7840 3.9038 2.9921 2.9166 2.6962

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by