Why can't I use crand() in matlab
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
It is supposed to generate a complex random number, and it worked on my friend's PC, but not mine.
0 commentaires
Réponse acceptée
per isakson
le 9 Déc 2019
Modifié(e) : per isakson
le 10 Déc 2019
>> which crand -all % -all toolboxes that are installed on my PC
C:\Program Files\MATLAB\R2018b\toolbox\robust\rctutil\crand.m
>> help crand
out = crand(dim1,dim2)
Complex random matrix generator: generates a complex,
random matrix with a uniform distribution of dimension
DIM1 x DIM2. If only one dimension argument is given,
the output matrix is square.
See also crandn, rand, randn and sysrand.
Star Strider's proposal is worth better than being deleted. Try this:
crand = @(m,n) randn(m,n) + 1i*randn(m,n);
C = crand(2,2)
Experiment to get different results, including with different random number generator functions
1 commentaire
Plus de réponses (1)
Bobby Cheng
le 30 Juin 2025
Modifié(e) : Steven Lord
le 30 Juin 2025
rand in MATLAB has complex support since R2022a. See the "Random Complex Numbers" example on that documentation page.
[SL: hyperlinked the function name and added mention of the example.]
0 commentaires
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!