I want to generate Three different random Communication Channels and sort it. Please help

1 visualización (últimos 30 días)
h1=(randn(1)+1j*randn(1));
h2=(randn(1)+1j*randn(1));
h3=(randn(1)+1j*randn(1));
z=sort(h1,h2,h3)
Error using sort
Dimension argument must be a positive integer.

Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de Jul. de 2021
h1=(randn(1)+1j*randn(1));
h2=(randn(1)+1j*randn(1));
h3=(randn(1)+1j*randn(1));
z=sort([h1,h2,h3])
z =
-0.2708 - 0.7018i -0.9067 - 0.1721i -1.4720 + 0.8297i
Note that by default, sort() operates along the first non-scalar dimension, so if you were to use vectors you would have to be careful about how you sorted.
h1=(randn(5,1)+1j*randn(5,1));
h2=(randn(5,1)+1j*randn(5,1));
h3=(randn(5,1)+1j*randn(5,1));
z=sort([h1,h2,h3], 2) %sort along rows
z =
-0.2910 - 0.0564i 0.5709 - 0.5409i 0.6546 - 0.5143i -0.1828 - 1.6783i -0.7043 - 2.3840i -1.8560 - 1.7280i 0.1197 - 0.5495i 0.4678 + 0.4002i 0.0720 + 1.4020i -0.0402 - 0.0571i -0.0619 + 0.6243i -1.6263 + 1.0778i -1.1198 + 0.7075i 0.3973 + 2.4295i 0.0284 + 2.7152i
However... you need to be clearer as to what it means to you to sort complex data. MATLAB has a meaning for sorting complex data, but it is not likely that MATLAB's meaning is the same as what you want.

Más respuestas (0)

Categorías

Más información sobre Propagation and Channel Models en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by