folks this code for transmitting "Hello" over matlab what is the wrong with it ?
2 views (last 30 days)
Show older comments
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 Comments
Aditi Jha
on 11 Nov 2021
I was looking for this program for an assignment do you mind helping me out?
Answers (1)
Walter Roberson
on 31 Aug 2015
tx_bs = [tx_bs, byte];
3 Comments
Walter Roberson
on 31 Aug 2015
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.
See Also
Categories
Find more on Web Services in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!