Vector question help?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hello,
A vector with 25 integer values that are randomly drawn in a normal distribution Standard ("randn" and "round" functions must be used).
help from someone?
Thanks.
1 commentaire
John D'Errico
le 9 Juil 2022
PLEASE STOP ASKING THE SAME QUESTION. You asked it yesterday. It got an answer. You ACCEPTED the answer. So why ask it again today?
Réponses (1)
Karim
le 9 Juil 2022
Modifié(e) : Karim
le 9 Juil 2022
% this step creates a vector with 25 normal distributed random values
MyVector = randn( 1,25 )
% if you want to round these values to obtain integers you can do:
MyRoundVector = round( MyVector )
However, note that (as John indicated) after the rounding the vector no follows a normal distribution. This vector simply contains the rounded values.
2 commentaires
John D'Errico
le 9 Juil 2022
Modifié(e) : John D'Errico
le 9 Juil 2022
The vector you have shown how to generate does NOT follow a normal distribution. Once rounded, the sample no longer comes from a normal distribution. That there is no answer to the question now asked multiple times by the poster is a better response.
Karim
le 9 Juil 2022
Indeed, thank you for pointing this out :) I updated the answer and added a few comments rather than deleting it.
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!