plot HHT in imagesc
5 views (last 30 days)
Show older comments
hello, can anyone help my problem,
I use script plot_hht.m from Mr. Alan Tan in Matlab http://www.mathworks.com/matlabcentral/fileexchange/19681-hilbert-huang-transform/content/plot_hht.m
% function plot_hht(x,Ts)
% Plot the HHT.
% plot_hht(x,Ts)
%
% :: Syntax
% The array x is the input signal and Ts is the sampling period.
% Example on use: [x,Fs] = wavread('Hum.wav');
% plot_hht(x(1:6000),1/Fs);
% Func : emd
% Get HHT.
N=1024;
t=linspace(1,2,N);
Ts=t(2)-t(1);
fs=1/Ts;
x(1:512)=5*sin(2*pi*100*t(1:512))+5*sin(2*pi*35*t(1:512));
x(513:1024)=5*sin(2*pi*20*t(513:1024));
plot(t,x);
aa=emd(x,0.05,100);
for ii=2:size(aa')
imf{ii-1}=aa(:,ii)
end
% imf = emd(x);
for k = 1:length(imf)
b(k) = sum(imf{k}.*imf{k});
th = angle(hilbert(imf{k}));
d{k} = diff(th)/Ts/(2*pi);
energy{k} = abs(hilbert(imf{k})).^2;
end
[u,v] = sort(-b);
b = 1-b/max(b);
% Set time-frequency plots.
N = length(x);
c = linspace(0,(N-2)*Ts,N-1);
figure,
for k = v(1:11)
hold on;
plot(c,d{k},'k.','Color',b([k k k]),'MarkerSize',3,'linewidth',1.5);
set(gca,'FontSize',8,'XLim',[0 c(end)],'YLim',[0 1/2/Ts]); xlabel('Time'), ylabel('Frequency');
end
I want the plot result in time-frequency-energy domain (x-y-z).... how I implement that in 'imagesc'
thank you
1 Comment
Santhana Raj
on 17 Jun 2012
hi,
I hav a doubt in ur question..... In the algorithm, u r calc energy for every k value. So u get a scalar value for each time frequency graph. For a 3D plot to exist, you require the third variable (energy) to be present at all 5999 values of the time and frequency plot.
i mean to say tat, u require to know the energy at each and every point in the time frequency graph. But the code above calculates net energy in the plot.
kindly point me out, if am mistaken.
regards,
A.S.Raj
https://sites.google.com/site/santhanarajarunachalam/
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!