In the first step I generated a sequence of bits (0,1)..
I used a randi command x = randi([0 1],1,3)
to generate random bits
I stuck with these 2 steps :
Divide sequence by 3 bits into 8 levels [000, 001, 010, 011, 100, 101, 110, 111]
For each quantum level assigns amplitude value from the range [-2, 2]
I won't provide the full source code to leave a bit of the homework for you, but I will give you some hints:
randi()
is creating a sequence of 0 and 1 floating point numbersbitpack
. This allows you to pack your bits from array elements into a single byte. Be aware that you need to provide an 8 element array of "bits" to fill a byte. User 'uint8' as the class argument.logical
array by using the logical()
function.linspace()
to create an array with 8 elements containing your equally spaces amplitude values