how to generate data rates in matlab
13 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi there, i would like to know how can i generate data at transmitter and send over the channel at specific data rate. Like i use randint command for data generation at rate of 10kbps(lets say) ....so far what i am doing is
for time_t = 0:inputBlockSize*Tb/Ts*Ts:1
if mod == 'QPSK'
sr = Rb/2;
tmp2 = [];
tmp1 = randint(1,2*inputBlockSize);
tmp = tmp1*2 - 1;
end
......... code goes on and on...........
end % time_t ends here
where inputBlockSize is 16 (say)... time_t is the time that i initialized and at each tick between 0sec to 1sec i generate 16bits where Tb = 1e-4 (data rate is 10kbps) and Ts is any sampling period. is it right definition of introducing data rate?
Does this make sense?
Thanx
0 Commenti
Risposte (1)
Rick Rosson
il 28 Ago 2011
Before jumping into a for loop, you should consider whether it is possible to vectorize this code. MATLAB is really good at handling large vectors and matrices, and performing linear algebra. Think about whether your algorithm can be done on the entire data set all at once, rather than in a massive for loop.
As a first step, you may want to define your time increment as a variable, perhaps called dt, so that you can validate if it is correct. So, for example:
dt = inputBlockSize*Tb/Ts*Ts;
disp(dt);
When MATLAB displays the value of dt, does it make sense to you? Also, notice that in the equation for dt, you first divide by Ts, and then immediately multiply by Ts. Is that really necessary? It would be more efficient to eliminate these two operations entirely:
dt = inputBlockSize*Tb;
disp(dt);
Does this code result in the same value for dt as before? Does this code make sense? Is the value of dt what you were expecting, or is it surprising?
HTH.
Best,
Rick
Vedere anche
Categorie
Scopri di più su Waveform Generation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!