How to code the following expression in MATLAB

Hello all, I am trying to understand how to code the following equation (1) in MATLAB: ----(1)
where,
, such that each of is a column vector of dimension 8 X 1, L denotes total time slots.
And each is drawn randomly from set .
Also i.e., denotes cardinality of a set.
If N = 16 and if are as follows:
x_1 = [xs xs 0 0 0 0 0 0 ]'; x_2 = [xs 0 xs 0 0 0 0 0 ]'; x_3 = [xs 0 0 xs 0 0 0 0 ]'; x_4 = [xs 0 0 0 xs 0 0 0 ]';
x_5 = [xs 0 0 0 0 xs 0 0 ]'; x_6 = [xs 0 0 0 0 0 xs 0 ]'; x_7 = [xs 0 0 0 0 0 0 xs ]'; x_8 = [0 xs xs 0 0 0 0 0 ]';
x_9 = [0 xs 0 xs 0 0 0 0 ]'; x_10 = [0 xs 0 0 xs 0 0 0 ]'; x_11 = [0 xs 0 0 0 xs 0 0 ]'; x_12 = [0 xs 0 0 0 0 xs 0 ]';
x_13 = [0 xs 0 0 0 0 0 xs]'; x_14 = [0 0 xs xs 0 0 0 0]'; x_15 = [0 0 xs 0 xs 0 0 0]'; x_16 = [0 0 xs 0 0 xs 0 0]';
where xs = sqrt(1/2)*(randn(1,1)+1i*randn(1,1)); % transmitted signal of Complex Gaussian nature
Any help in this regard will be highly appreciated.

2 Comments

Any logic will help to code it more effectively.
Can we say that MATLAB cannot solve such expressions....

Sign in to comment.

Answers (1)

To get L random columns from xgssk, you can use randperm
randomColumns = randperm(size(xgssk, 2), L);
X = xgssk(1:8, randomColumns); % 8 by L matrix
You can get a random index and value from column vector xi also using randperm
index = randperm(numel(xi), 1);
value = xi(index);

5 Comments

Thank u so much sir for your response....
I am not getting how cardinality of set is and how to implement it in MATLAB.
I think by x[1] it means your x_1 column vector, and x[2] is really x_2 so you construct xgssk like
xs = sqrt(1/2)*(randn(1,1)+1i*randn(1,1)); % transmitted signal of Complex Gaussian nature
x_1 = [xs xs 0 0 0 0 0 0 ]';
x_2 = [xs 0 xs 0 0 0 0 0 ]';
x_3 = [xs 0 0 xs 0 0 0 0 ]';
x_4 = [xs 0 0 0 xs 0 0 0 ]';
x_5 = [xs 0 0 0 0 xs 0 0 ]';
x_6 = [xs 0 0 0 0 0 xs 0 ]';
x_7 = [xs 0 0 0 0 0 0 xs ]';
x_8 = [0 xs xs 0 0 0 0 0 ]';
x_9 = [0 xs 0 xs 0 0 0 0 ]';
x_10 = [0 xs 0 0 xs 0 0 0 ]';
x_11 = [0 xs 0 0 0 xs 0 0 ]';
x_12 = [0 xs 0 0 0 0 xs 0 ]';
x_13 = [0 xs 0 0 0 0 0 xs]';
x_14 = [0 0 xs xs 0 0 0 0]';
x_15 = [0 0 xs 0 xs 0 0 0]';
x_16 = [0 0 xs 0 0 xs 0 0]';
xgssk = [x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10, x_11, x_12, x_13, x_14, x_15, x_16]
xgssk =
Columns 1 through 10 -0.8427 + 0.9780i -0.8427 + 0.9780i -0.8427 + 0.9780i -0.8427 + 0.9780i -0.8427 + 0.9780i -0.8427 + 0.9780i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i -0.8427 + 0.9780i -0.8427 + 0.9780i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i Columns 11 through 16 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i -0.8427 + 0.9780i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i -0.8427 + 0.9780i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.8427 + 0.9780i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
@Image Analyst Thank u sir....I had also prepared the in the same way...but the problem is that I am not getting what cardinality has to do with it...I mean I am nowhere finding the ....
It says the cardinality is N^L or 16^8 = 4294967296
@Image Analyst In my case L is not 8 but its value is 500....so cardinality should be 16^500.

Sign in to comment.

Asked:

on 22 Oct 2023

Commented:

on 25 Oct 2023

Community Treasure Hunt

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

Start Hunting!