folks this code for transmitting "Hello" over matlab what is the wrong with it ?
2 次查看(过去 30 天)
显示 更早的评论
tx_msg = 'Hello'; % message to transmit
SPB = 10; % bit time in samples per bit
% transmitter %
%------tx_bs=text2bitseq(tx_msg)-------
tx_bs = [];
for c = 1:length(tx_msg)
character = tx_msg(c); % get the next character from the msg
byte = char2byte(character); % find the 8-bit ASCII
tx_bs = [byte];
end
%------tx_bs=text2bitseq(tx_msg)-------
tx_wave = bitseq2waveform(tx_bs,SPB); % change bit sequence to a waveform
% The following command is needed so that we satisfy the communication protocol.
% We will study this later in the course.
tx_wave1 = satisfy_protocol(tx_wave,SPB);
% channel %
rx_wave = txrx(tx_wave1); % transmit waveform through channel
% receiver %
rx_bs = waveform2bitseq(rx_wave,SPB); % change waveform to bit sequence
rx_msg = bitseq2text(rx_bs); % change bit sequence to text message
diagram_lab01(tx_bs,tx_wave,rx_wave,rx_bs,SPB); % generate plots
display_lab01(tx_msg,rx_msg); % display text messages
2 个评论
回答(1 个)
Walter Roberson
2015-8-31
tx_bs = [tx_bs, byte];
3 个评论
Walter Roberson
2015-8-31
Inside your loop you currently have
tx_bs = [byte];
that overwrites all of tx_bs with the value in byte. You want to instead add byte to the end of the vector, which you do with
tx_bs = [tx_bs, byte];
in place of your current line of code.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Web Services 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!