Dynamic spectra for 1000 files

1 view (last 30 days)
Hello,
I would like to make dynamic spectra of two columns data. 1st column has frequency and other column has power from spectrum analyzer in dBm units.
Dynamic spectra is defined as intensity as a function of time and frequency. Here time is two and half hours of observation. I have 1000 .txt files then how
to create dynamic spectra ?

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 6 Mar 2020
Edited: Bjorn Gustavsson on 6 Mar 2020
It is unclear what data you have in your files. Is it frquency and power-spectra from spectrum analyzer? If so then you can simply merge them together in order-of-time:
dFiles = dir('*.txt');
for i1 = numel(dFiles):-1:1
curr_data = load(dFiles(i1).name);
P(1:numel(curr_data)/2,i1) = curr_data(:,2);
F(1:numel(curr_data)/2,i1) = curr_data(:,1);
T(i1) = 2.5*3600*(i1-1);
end
If you on the other hand have the actual signal samples saved for a time-span of 2.5 hours split into 1000 files then just merge them together and calculate the spectrogram with for example the spectrogram function.
HTH
  1 Comment
Pritpal Kaur
Pritpal Kaur on 7 Mar 2020
Thanks for a kind message. Yes, data in files are frequency and power-spectra from spectrum analyzer. The above mention code run successfully. F = 401 x 1000, P = 401 x 1000, T = 1 x 1000 are displayed on the workspace. 401 are data points in each file. Each file having 5 seconds of interval. To construct dynamic spectra, we need to calculate the spectrogram. Simply, write spectrogram (P,F,T) on the editor. The blank figure window comes out. Kindly, help me for calculation of spectrogram.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!