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

8 views (last 30 days)
I want to plot time vs. frequency curve of time-series data. Can anybody help me?
N.B. Please see the attachment
  3 Comments
Partha
Partha on 5 Apr 2015
Edited: Partha on 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');

Sign in to comment.

Answers (1)

Orion
Orion on 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 Comments
Partha
Partha on 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?

Sign in to comment.

Categories

Find more on Wavelet Toolbox 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!