How to perform OOK modulation on Audio signal?
11 ビュー (過去 30 日間)
古いコメントを表示
I have to convert my Audio signal in to discrete form and have to perform OOK modulation on it.
0 件のコメント
回答 (1 件)
Walter Roberson
2018 年 6 月 21 日
6 件のコメント
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 Center および File 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!