Capturing 10sec duration signal

Follow our development of DSP and SDR tutorials
Post Reply
awais
Posts: 3
Joined: Thu Jun 09, 2022 2:57 am

Capturing 10sec duration signal

Post by awais »

Here is my code that I am testing on BladeRF Small Rev. 2:

---------------------------------------
% Initialize BladeRF object
bladeRF = bladeRF('*:serial=123');

% Set device parameters
bladeRF.rx.samplerate = 1e6; % 1 MHz sample rate
bladeRF.rx.frequency = 2.4e9; % 2.4 GHz center frequency
bladeRF.rx.config.num_buffers = 32; % Number of buffers
bladeRF.rx.config.buffer_size = 4096; % Buffer size

% Calculate the number of samples to receive
duration = 10; % Duration in seconds
numSamples = bladeRF.rx.samplerate * duration;

% Start receiving
bladeRF.rx.start();

% Receive samples
samples = bladeRF.receive(numSamples);

% Stop receiving
bladeRF.rx.stop();

% Plot the received signal
time = (0:numSamples-1) / bladeRF.rx.samplerate;
plot(time, real(samples));
xlabel('Time (s)');
ylabel('Amplitude');
title('Received Signal');
----------------------------------
After executing this code in Matlab, it generates an array 'samples' with 10000000x1 complex doubles. But when I open it, it only has 256 non-zero samples, rest are all zeros. Why?

Even changing the duration to other values, I still have 256 non-zero samples. Rest are always zeros.

I want to capture 10 sec waveform in MATLAB using my SDR and want to visualize it in MATLAB.

Can anyone please help?

Thanks
Post Reply