how to convert analog signal to bit stream
36 ビュー (過去 30 日間)
古いコメントを表示
I generate a analog signal cos(2pi*f*t), fs is sampling frequency and I denotes quantization levels. How to convert the analog signal to bit stream
2 件のコメント
回答 (1 件)
Walter Roberson
2021 年 8 月 3 日
That is not an analog signal. An analog signal is created by outputing to a hardware device. What you have is a digital signal.
Your description said I denotes quantization levels. If so then
I = linspace(-1,1,32);
t = linspace(0,1,75);
f = 17;
x = cos(2*pi*f*t);
plot(t, x)
binnumber = discretize(x, I) - 1;
binnumber(1:10)
num_bits = ceil(log2(length(I)))
as_char_binary = dec2bin(binnumber, num_bits);
as_char_binary(1:5,:)
binary_stream = reshape((as_char_binary - '0').',1,[]);
stairs(binary_stream); ylim([-.1 1.1]); xlim([0 50])
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Periodic Waveform Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!