How to decrease elapsed time in the while loop?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I’m working on a radar project using USRP N210 with UBX-40 daughterboard using MATLAB. I am facing a problem when I run the code for receiving the echo of the transmitted pulse. It is taking 4 seconds for the board to start receiving and collecting first sample, which doesn’t suit at all my case. After the first sample, receiving elapsed time for the other echoes is in milliseconds which not good because, echoes in radars should be received within microseconds or less and not seconds and milliseconds!!
clear;
clc;
Fs= 50e6; % Sampling freq
t=0:1/Fs:10-1/Fs; %Time vector
PRI = 10e-6; %PRI
pw = 0.04e-6; %pulse width
d= 0:PRI:10; %delay vector
y_pulse = ones(Fs*pw,1);
connectedRadios = findsdru;
if strncmp(connectedRadios(1).Status, 'Success', 7)
radioFound = true;
platform = connectedRadios(1).Platform;
switch connectedRadios(1).Platform
case {'B200','B210'}
address = connectedRadios(1).SerialNum;
case {'N200/N210/USRP2','X300','X310'}
address = connectedRadios(1).IPAddress;
end
else
radioFound = false;
address = '192.168.10.2';
platform = 'N200/N210/USRP2';
end
gn = 23;
inf1=2;
rfTxFreq = 5e9; % RF Transmitter Center Frequency (Hz)
radioTx = comm.SDRuTransmitter('Platform', platform, ...
'IPAddress', address, ...
'CenterFrequency', rfTxFreq,...
'Gain', gn, ...
'InterpolationFactor', inf1)
radioRx = comm.SDRuReceiver(...
'Platform', platform, ...
'IPAddress', address, ...
'CenterFrequency', rfTxFreq,...
'Gain', gn, ...
'DecimationFactor', inf1,...
'SamplesPerFrame', 498,...
'OutputDataType','single')
for i=1:5
step(radioTx,y_pulse)
timeCounter = 0;
tic
while timeCounter < 1
[x, len] = step(radioRx);
pulses(:,i)=x ;
if len > 0
timeCounter = timeCounter + 1;
end
end
end
toc
release(radioTx)
release (radioRx)
clear radioRx
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Communications Toolbox 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!