Jump to content
Mechanical Engineering

how to draw a 3D-HHT using MATLAB,here is a good example for us.


Ching

Recommended Posts

clc
clear
close all
fs = 1024;
n = 1024;
t = 0:1/fs:(n-1)/fs;
y = sin(2*pi*50*t) + 0.4*cos(2*pi*150*t);
figure,plot(y)
set(gca,'xlim',[0,1024])
imf = emd(y);
plot_hht_3d(imf,1024,1024,[-60,50])
函数参数分别为:
imf:emd分解后的结果
numfreq:划分的频率个数
fs:采样频率
ANGLE:视图角度

附录:

function plot_hht_3d(imf,numfreq,fs,ANGLE)
if nargin<3
    fs=1;
    ANGLE=[-37.5,30];
end
if nargin<4
    if size(fs,2)>1
        ANGLE=fs;
        fs=1;
    else
        ANGLE=[-37.5,30];
    end   
end
N=size(imf,2);
[A,f,tt]=hhspectrum(imf);
[m,n]=size(f);
MaxFreq=max(max(f));
MaxFreq=ceil(MaxFreq/0.5)*0.5;
if nargin<2
    numfreq=512;
end
df=linspace(0,MaxFreq,numfreq);
Spectrum=zeros(numfreq,n);
Temp=f;
Temp=min(round((Temp/MaxFreq)*numfreq)+1,numfreq);
for k=1:m
    for u=1:n
        Spectrum(Temp(k,u),u)=Spectrum(Temp(k,u),u)+A(k,u);
    end
end
df=df*fs;
figure
clf
mesh(tt,df,Spectrum);
set(gca,'XLim',[0,N]);
xlabel('采样点数/n');
if fs==1
    ylabel('归一化频率');
else
    ylabel('频率/Hz');
end
zlabel('幅值');
title('三维联合时频图');
colormap jet;
shading interp;
view(ANGLE(1),ANGLE(2));
set(gca,'YLim',[0,fs/2]);
end

1.jpg

2.jpg

Link to comment
Share on other sites




Dear Ching,

I have no need for this personally, but if it is worth posting, it must be worth posting where a reader can understand it. In this case, since this is an English language site, that means putting it all in English.

What is the value of the Hilbert-Huang transform? What sort of problems and solution processes call for it? There is a lot more you could say that would make your note more interesting and of greater value.

DrD

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Join Mechanical Engineering network

    Join us (login) to get full access : Please sign up to connect and participate.

    To download files...please login

  • Who's Online   1 Member, 0 Anonymous, 24 Guests (See full list)






×
×
  • Create New...