How can I plot a column vector of 32 bit floating points
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello, I am using the matlab scripts drived from GNU Radio. I have taken a binary output from GNU Radio and have opened the file into my script below. i am having issues in plotting the column vector obtained from this script in a frequency vs time domain on a spectrogram plot. Reading the documentation on the spectrogram, I am still lost as to how to accomplish this feat. any guidance is appreciated.
My output from the command window (32 bit float column vector) which I would like to plot in a frequency vs time spectrogram:
-0.9217 - 0.3663i
1.1827 - 0.3266i
-0.2516 + 1.9482i
-0.4526 - 1.6277i
0.4382 - 0.3797i
function v = read_complex_binary (MATLAB_file , count)
%% usage: read_complex_binary (filename, [count])
%%
%% open filename and return the contents, treating them as
%% 32 bit floats
%%
if (nargin < 2)
%count = Inf;
count = 2000;
end
f = fopen ('signal_data', 'rb');
if (f < 0)
v = 0;
else
t = fread (f, [2, count], 'float'); % reads matlab_file reads in number of elemnts in the file (a) as pairs with type float
fclose (f);
v = t(1,:) + t(2,:)*i; % reads the first row and second row of the data and scans through
[r, c] = size (v); % creates a matrix and returns the rows and columns seperately
v = reshape (v, c, r); %reshapes 'V' into an 'c'x'r' array
a = 0:0.5:20;
%x = (a,v,1,200);
spectrogram(v,blackman(256), 'xaxis') % plot v on a spectrogram
end
1 Kommentar
Srivardhan Gadila
am 7 Apr. 2020
@Saxfield Chatmon, you said that you are having issues in plotting the column vector obtained from this script in a frequency vs time domain on a spectrogram plot. Can you state the exact issue, reproduction steps, required code, functions & variables with their values.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Time-Frequency Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!