Please Help! : Unrecognized function or variable 'crandn'.

9 vues (au cours des 30 derniers jours)
Alvin Ang
Alvin Ang le 27 Fév 2022
% simple SIMO system
m = 2;
l = 20;
alphabet = [ exp(j*pi/4); exp(j*3/4*pi); exp(j*5/4*pi); exp(j*7/4*pi) ];
h0 = crandn(m, 1);
h1 = crandn(l, 1);
h2 = crandn(m, l);
hmatrix1 = diag(h1);
ptx = 1;
vinit = alphabet(round(4*rand(l, 1)+0.5));
htotinit = (h0+h2*diag(vinit)*h1)*sqrt(ptx);
ginit = htotinit/(1+htotinit'*htotinit);
mseinit = 1/(1+htotinit'*htotinit);
gold = ginit;
vold = vinit;
mseold = mseinit;
iter = 1;
while 1 == 1,
a = hmatrix1'*h2'*gold;
b = gold'*h0-1;
vcand = b/abs(b)*a./abs(a);
vnew = zeros(l, 1);
vnew = sqrt(2)*((real(vnew) > 0)-0.5+j*(imag(vnew) > 0)-0.5);
if round(norm(vnew-vold)) == 0,
break;
end
htotnew = (h0+h2*diag(vnew)*h1)*sqrt(ptx);
gold = 1/(1+htotnew'*htotnew)*htotnew;
mseold = 1/(1+htotnew'*htotnew);
msenew = mseold
vold = vnew;
iter = iter+1;
end
msenew = 0.0055
disp(sprintf("MSEinit=%f", mseinit))
MSEinit=0.011244
disp(sprintf("MSEupdated=%f", msenew))
MSEupdated=0.005515
disp(sprintf("number of iterations=%i", iter))
number of iterations=2
Why is my matlab showing this error?
I am able to run my code here but not in my matlab program.
Can anyone help?

Réponse acceptée

Walter Roberson
Walter Roberson le 27 Fév 2022
Modifié(e) : Walter Roberson le 30 Juin 2025
  4 commentaires
Alvin Ang
Alvin Ang le 27 Fév 2022
Oh I understand now, i have to install the toolbox. Thank you.
Walter Roberson
Walter Roberson le 27 Fév 2022
Modifié(e) : Walter Roberson le 30 Juin 2025

Connectez-vous pour commenter.

Plus de réponses (1)

Bobby Cheng
Bobby Cheng le 30 Juin 2025
Modifié(e) : Steven Lord le 30 Juin 2025
Just come across this. A bit slow news. But randn supports generating complex number since R2022a.
[SL: hyperlinked the function name.]

Catégories

En savoir plus sur Startup and Shutdown 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!

Translated by