How to perform OOK modulation on Audio signal?

조회 수: 11 (최근 30일)
Asra Khalid
Asra Khalid 2018년 6월 21일
댓글: Walter Roberson 2018년 6월 26일
I have to convert my Audio signal in to discrete form and have to perform OOK modulation on it.

답변 (1개)

Walter Roberson
Walter Roberson 2018년 6월 21일
  댓글 수: 6
Asra Khalid
Asra Khalid 2018년 6월 26일
편집: Walter Roberson 2018년 6월 26일
sigbin = reshape( (dec2bin(signal(:,1), 8) - '0').', 1, []);
byte = sum(group_of_8 .* 2.^(7:-1:0))
Can you explain these two commands? How did you choose these values?
Walter Roberson
Walter Roberson 2018년 6월 26일
signal(:,1) is the first channel of the input signal.
dec2bin(something, 8) converts the input to character-coded binary with a minimum of 8 bits. 8 is specified because it could happen that the range of input values took less than 8 bits and we need a constant output width for the rest to work.
Subtracting the character '0' from the dec2bin() result converts each '0' to 0 and '1' to 1, thereby converting from character-coded binary to numeric binary.
dec2bin creates output in which the bits for any one input are across the rows. We want to take that output and make a single row vector in which the bits for any one input are beside each other. We start by transposing so that the bits for one output go down the columns, so 8 rows by however many columns are needed. With that memory arrangement, we can now reshape to 1 row and as many columns are needed.
a7 a6 a5 a4 a3 a2 a1 a0
b7 b6 a5 b4 b3 b2 b1 b0
->
a7 b7
a6 b6
a5 b5
a4 b4
a3 b3
a2 b2
a1 b1
a0 b0
->
a7 a6 a5 a4 a3 a2 a1 a0 b7 b6 b5 b4 b3 b2 b1 b0
The reconstruction formula I gave takes a single group of 8 numeric bits like a7 a6 a5 a4 a3 a2 a1 a0 and constructs the numeric vector 2^(7:-1:0) which is 2^[7 6 5 4 3 2 1 0] which is [128 64 32 16 8 4 2 1] . It multiplies the a7 a6 a5 a4 a3 a2 a1 a0 by that, getting a7*128 a6*64 a5*32 a4*16 a3*8 a2*4 a1*2 a0*1 . Then it adds those getting a7*128+a6*64+a5*32+a4*16+a3*8+a2*4+ a1*2+a0*1 . Which is precisely the numeric integer reconstruction of the binary sequence a7 a6 a5 a4 a3 a2 a1 a0, by definition.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by