Array of fixed length

A user inputs a value n.
I want to make an array that has n values, 1/n.
If n=4, output would be
[1/4 1/4 1/4 1/4]
Not quite sure how to do this.

1 commentaire

Walter Roberson
Walter Roberson le 9 Déc 2020
Hint: ones(), or repmat(), or repelem() .

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange

Question posée :

le 9 Déc 2020

Commenté :

le 9 Déc 2020

Community Treasure Hunt

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

Start Hunting!

Translated by