2
votes

I want to create a 2d plot of hilbert spectrum. What i want is a time vs frequency plot, where the amplitude of the signal is represented by color changes in the plot.

What i have done is this, but I need it to look like this.

Thank you in advance

EDIT:

I have the values of amplitude and instantaneous frequency over time, that i have produced using Hilbert Huang Transform. Let's say we only use the first IMF, and we have 100 samples. Then what we have is:

    instantaneous_frequency = [f1 f2 f3 ... f100]
    instantaneous_amplitude = [a1 a2 a3 ... a100]
    time = [t1 t2 t3 ... t100]

What i need is a way to plot them like the second image, without using the spectrogram function, since it uses STFT and I have already applied HHT.

The code for producing the first plot is:

Time_Window = 1:101;
signal= rand(1,101);
hilb = hilbert(signal);
inst_amp = abs(hilb);
inst_th = angle(hilb);
inst_freq = diff(a_inst_th)/(1/256)/(2*pi); %instantaneous frequency 
%inst_freq = remove_outliers(inst_freq,Time_Window(1:end-1)); 
inst_freq(end+1) = inst_freq(end); % This is done due to diff()
plot(Time_Window*4,inst_freq,'k.','MarkerSize',5)
1
Posting the code for what you have done would be useful in getting you toward your goal... - wogsland
Added sample code in the question! :) - achigeor

1 Answers

0
votes

There is already a MATLAB function to produce a spectrogram, which looks a lot like what you want. See if that solves your problem.