How can I plot time vs. frequency curve of time-series data?

1 Ansicht (letzte 30 Tage)
Partha
Partha am 10 Nov. 2014
Bearbeitet: Partha am 5 Apr. 2015
I want to plot time vs. frequency curve of time-series data. Can anybody help me?
N.B. Please see the attachment
  3 Kommentare
Partha
Partha am 5 Apr. 2015
Bearbeitet: Partha am 5 Apr. 2015
Is there is any difference between the following codes?
NS = Noisy Signal; windowsize = 128; window = hanning(windowsize); nfft = windowsize; noverlap = windowsize-1; [S_NS F_NS T_NS P_NS] = spectrogram(NS,window,noverlap,nfft,Fs,'yaxis'); AMP_NS = 10*log10(abs(S_NS)); imagesc(T_NS*1e3,F_NS*1e-6,AMP_NS)
and
spectrogram(NS,window,noverlap,nfft,Fs,'yaxis');

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Orion
Orion am 10 Nov. 2014
Ok, I will not read this full paper.
But I guess you want to make figures like the number 5.
You need to use spectrogram
  2 Kommentare
Youssef  Khmou
Youssef Khmou am 11 Nov. 2014
spectrogram is the right function .
Partha
Partha am 5 Apr. 2015
I use the following code
function FRQ_Plot(NS,DNS)
global Fs fn wname tt lcf hcf
% plotting of the spectrogram
window = 1024; %window = Hamming window of length nfft. noverlap = (3/4)*window; %noverlap = Number of samples that each segment overlaps. nfft = []; %nfft = FFT length and is the maximum of 256 or the next power of 2 greater than the length of each segment of x. F = [0 10e6 20e6 30e6]; %F = Vector of frequencies (Instead of nfft).
[S_NS F_NS T_NS P_NS] = spectrogram(NS,window,noverlap,nfft,Fs,'yaxis');AMP_NS = abs(S_NS); [S_DNS F_DNS T_DNS P_DNS] = spectrogram(DNS,window,noverlap,nfft,Fs,'yaxis');AMP_DNS = abs(S_DNS);
figure(fn) subplot(211),imagesc(T_NS*1e3,F_NS*1e-6,AMP_NS),colormap(gray);colormap(flipud(colormap)),colorbar('location','northoutside'),set(gca,'YDir','normal') subplot(212),imagesc(T_DNS*1e3,F_DNS*1e-6,AMP_DNS),colormap(gray);colormap(flipud(colormap)),colorbar('location','northoutside'),set(gca,'YDir','normal') fn = fn + 1;
figure(fn) subplot(211),spectrogram(NS,window,noverlap,nfft,Fs,'yaxis'),colormap(gray);colormap(flipud(colormap)),colorbar('location','northoutside') subplot(212),spectrogram(DNS,window,noverlap,nfft,Fs,'yaxis'),colormap(gray);colormap(flipud(colormap)),colorbar('location','northoutside') fn = fn + 1;
return
Please find the attachments for figures
Which one is correct?

Melden Sie sich an, um zu kommentieren.

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!

Translated by