- https://fr.mathworks.com/matlabcentral/fileexchange/41334-imshow3d
- https://fr.mathworks.com/matlabcentral/fileexchange/29544-figure-to-play-and-analyze-videos-with-custom-plots-on-top
Creating an accurate Doppler spectrogram visualization
11 views (last 30 days)
Show older comments
Hello! I'm trying to view and listen to an audio file (Doppler file). I want to display the spectrogram and have a scroll bar to navigate through the entire signal. Additionally, I'd like to be able to play or stop the audio.
I need something like this:
And I have this:
Here is my code:
fid = fopen('TCD_01.bin');
block_size = strread(fgetl(fid),'###block_size::%d');
block_number = strread(fgetl(fid),'###block_numbers::%d');
for k=1:8
fgetl(fid)
end
prf = strread(fgetl(fid),'###prf::%d');
offset = block_size * block_number;
fseek(fid,offset,'bof');
a = fread(fid, [4,inf],'float32')';
b1 = complex(a(:,2), a(:,1));
b2 = complex(a(:,4), a(:,3));
Fs=prf
NFFT = 128;
f_vec = [-floor(NFFT/2) : ceil(NFFT/2)-1] * Fs/NFFT;
figure, spectrogram(b1,hamming(128),64,f_vec,Fs,'yaxis');
caxis([0 20])
How can I achieve a result identical to the first part of the first image?
Thank you!
0 Comments
Accepted Answer
Matt
on 20 Oct 2023
Well there is quite a long way to go from this figure to a fully functionnal app like the one you are showing !
What you need is an app with callbacks connected to the scroll bar and the play/stop button.
It's not that easy to develop an app that is fast enough to display frames that are computed on the fly so I would recommend avoiding the app designer and go with something like this :
I used the second one, it is very nice and easy to modify for your needs.
Instead of having a callback function that simply display frames it will need to compute the image you want to show. It's not impossible but the computation need to be fast.
The play stop button will be the easy part, you can do a button with uicontrol connected to this :
https://fr.mathworks.com/help/matlab/import_export/record-and-play-audio.html#bsdl2eo-1
Additionnal infos :
https://fr.mathworks.com/matlabcentral/answers/483657-how-to-create-a-gui
More Answers (0)
See Also
Categories
Find more on Simulation, Tuning, and Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!