I am creating a model in MATLAB to simulate power line communication, but I found a problem. I'm very new to the DSP area, I get my code below from a MATLAB example.
%mod/demod GMSK hMod = comm.GMSKModulator('BitInput', true, 'InitialPhaseOffset', pi/4); hAWGN = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)','SNR',0); hDemod = comm.GMSKDemodulator('BitOutput', true,'InitialPhaseOffset', pi/4); % Error calculator by viterbi algortim hError = comm.ErrorRate('ReceiveDelay', hDemod.TracebackDepth); for counter = 1:10 % mod 10 words of 8-bits data = randi([0 1],8,1); modSignal = step(hMod, data); noisySignal = step(hAWGN, modSignal); receivedData = step(hDemod, noisySignal); errorStats = step(hError, data, receivedData); end
How can I discover the delay of my mod/demod process and fix that? Basically what I saw debugging the code was: my output (
receivedData) only start to receive the data after the third iterarion of the for-loop.
And another doubt, If I want to store the values of the input data like
First data send -> 11110000 First output data in the vector -> 11110000
How should I handle the delay to store the values like above? (Basically is, store the first value send in the first position of my matrix/vector, store the second value send in the second position of my matrix/vector. All of this into the for-loop;