What does toeplitz do in this code?

2 views (last 30 days)
Fariha Sneha
Fariha Sneha on 8 Apr 2019
Commented: Guillaume on 8 Apr 2019
hello.can anyone help me to understand this code about mimo correlated fading channel?i
will be forever greatful.
function hh=channel coeff(NR,NT,n,rtx,rrx,type)
h=sqrt(1/2)*(randn(nr*nt,n)+j*randn(nr*nt,n))
if nargin,hh=h; return,end
if isvector(rtx)=toeplitz(rtx);
if isvector(rrx),toeplitz(rrx);
if strcmp(type,'complex')
c=chol(kron(rtx,rrx));
else
c=sqrtm(sqrt(kron(rtx,rrx)));
end
hh=zeros(nr,nt,n);
for i=1:n
tmp=c*h(: ,);
hh(: , : , i)=reshape(nr*nt*n);
end
  2 Comments
Matt J
Matt J on 8 Apr 2019
Looks like a coding bug to me.
Guillaume
Guillaume on 8 Apr 2019
if isvector(rtx)=toeplitz(rtx);
is not valid matlab syntax. The = is illegal there, and the if appears to be missing a matching end
if isvector(rrx),toeplitz(rrx);
is also missing a matching end. Otherwise the syntax is legal but since the result of toeplitz is not assigned to anything, the whole thing is pointless.
Perhaps the best person to ask about this code is the author.
I wouldn't recommend using unknown code that does not even have a single comment explaining what it does. That's not a very good mark of quality.

Sign in to comment.

Answers (0)

Categories

Find more on Propagation and Channel Models in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!