声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 4334|回复: 25

[综合] 请教一个时频画图问题

[复制链接]
发表于 2007-4-17 10:25 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
用contour命令跟imagesc命令画出的图形,请帮忙看下,为什么imagesc命令画出的图形是错的啊!谢谢!!

新建 Microsoft Word 文档.doc

54.5 KB, 下载次数: 58

回复
分享到:

使用道具 举报

 楼主| 发表于 2007-4-17 15:38 | 显示全部楼层

回复 #1 xiw 的帖子

我改用pcolor命令后画出的图形是一片黑的,请问这是什么原因呢?用contour可以画的应该是用pcolor也可以画吧??
发表于 2007-4-18 22:03 | 显示全部楼层
我也有同样的困扰啊,我在用HHT检测语音基音,要画Hibert振幅谱,不会啊,请问谁知道啊,请教了:'( :@L
发表于 2007-4-18 22:07 | 显示全部楼层
谁知道啊,我用下载的那个toimage也不行啊,晕死了。eight能不能解答一下啊:'(
发表于 2007-4-18 22:07 | 显示全部楼层

回复 #3 linqin1201 的帖子

好好搜索一下论坛的帖子,对你会有帮助的
发表于 2007-4-18 22:12 | 显示全部楼层
谁知道啊,我用下载的那个toimage也不行啊,晕死了。eight能不能解答一下啊
发表于 2007-4-18 22:18 | 显示全部楼层
论坛上没有啊,zhangnan3509你可懂啊,可以交流一下吗? 我的qq是:33538955:@)
发表于 2007-4-18 22:24 | 显示全部楼层

回复 #7 linqin1201 的帖子

function [im,tt] = toimage(A,f,t,splx,sply)

% [im,tt] = TOIMAGE(A,f,t,splx,sply) transforms a spectrum made
% of 1D functions (e.g., output of "spectreh") in an 2D image
%
% inputs :   - A    : amplitudes of modes (1 mode per row of A)
%            - f    : instantaneous frequencies
%            - t    : time instants
%            - splx : number of columns of the output im (time resolution).
%                     If different from length(t), works only for uniform
%                     sampling.
%            - sply : number of rows of the output im (frequency resolution).
% outputs :  - im   : 2D image of the spectrum
%            - tt   : time instants in the image
%
% utilisation : [im,tt] = toimage(A,f);[im,tt] = toimage(A,f,t);[im,tt] = toimage(A,f,sply);
%              [im,tt] = toimage(A,f,splx,sply);[im,tt] = toimage(A,f,t,splx,sply);

DEFSPL = 400;

if nargin < 3
  t = 1:size(A,2);
  sply = DEFSPL;
  splx = length(t);
else
    if length(t) == 1
        tp = t;
        t = 1:size(A,2);
        if nargin < 4
            sply = tp;
            splx = length(t);
        else
            if nargin > 4
                error('too many arguments')
            end
            sply = splx;
            splx = tp;
        end
    else
        lt = length(t);
        if nargin < 5
          sply = splx;
          splx = lt;
        end

        if nargin < 4
          sply = DEFSPL;
          splx = lt;
        end
        
        if nargin > 5
            error('too many arguments')
        end
    end
end
   
lt=length(t);

im=[];
im(splx,sply) = 0;

for i=1:size(f,1)
  for j = 1:lt
    ff=floor(f(i,j)*2*(sply-1))+1;
    if ff <= sply % in case f(i,j) > 0.5
      im(floor(j*(splx-1)/lt)+1,ff)=im(floor(j*(splx-1)/lt)+1,ff)+A(i,j);
    end
  end  
end

for i = 1:splx
  tt(i) = mean(t(floor((i-1)*lt/(splx))+1:floor(i*lt/(splx))));
end

im=fliplr(im)';
发表于 2007-4-18 22:24 | 显示全部楼层

回复 #7 linqin1201 的帖子

function [A,f,tt] = hhspectrum(imf,t,l,aff)

% [A,f,tt] = HHSPECTRUM(imf,t,l,aff) computes the Hilbert-Huang spectrum
%
% inputs:
%         - imf : matrix with one IMF per row
%   - t   : time instants
%   - l   : estimation parameter for instfreq
%   - aff : if 1, displays the computation evolution
%
% outputs:
%   - A   : amplitudes of IMF rows
%   - f   : instantaneous frequencies
%   - tt  : truncated time instants
%
% calls:
%   - hilbert  : computes the analytic signal
%   - instfreq : computes the instantaneous frequency

if nargin < 2

  t=1:size(imf,2);

end

if nargin < 3

  l=1;

end

if nargin < 4

  aff = 0;

end

lt=length(t);

tt=t((l+1):(lt-l));

for i=1:(size(imf,1)-1)

  an(i,:)=hilbert(imf(i,:)')';
  f(i,:)=instfreq(an(i,:)',tt,l)';
  A=abs(an(:,l+1:end-l));

  if aff

    disp(['mode ',int2str(i),' trait?'])

  end

end
发表于 2007-4-18 22:25 | 显示全部楼层

回复 #7 linqin1201 的帖子

function disp_hhs(im,t,inf)

% DISP_HHS(im,t,inf)
% displays in a new figure the spectrum contained in matrix "im"
% (amplitudes in log).
%
% inputs : - im : image matrix (e.g., output of "toimage")
%          - t (optional) : time instants (e.g., output of "toimage")
%          - inf (optional) : -dynamic range in dB (wrt max)
%            default : inf = -20
%
% utilisation : disp_hhs(im) ; disp_hhs(im,t) ; disp_hhs(im,inf)
%              disp_hhs(im,t,inf)

figure
colormap(bone)
colormap(1-colormap);

if nargin==1
  inf=-20;
  t = 1:size(im,2);

end

if nargin == 2
  if length(t) == 1
    inf = t;
    t = 1:size(im,2);
  else
    inf = -20;
  end
end

if inf >= 0
  error('inf doit etre < 0')
end

M=max(max(im));

im = log10(im/M+1e-300);

inf=inf/10;


imagesc(t,fliplr((1:size(im,1))/(2*size(im,1))),im,[inf,0]);
set(gca,'YDir','normal')
xlabel(['time'])
ylabel(['normalized frequency'])
title('Hilbert-Huang spectrum')
发表于 2007-4-18 22:26 | 显示全部楼层
也就这几个做HHT谱的程序,你自己调试一下
发表于 2007-4-18 22:41 | 显示全部楼层
:@(   就是附件这个图是咋画的啊?:@L
3.BMP
发表于 2007-4-18 22:44 | 显示全部楼层
横轴是时间,纵轴是频率
发表于 2007-4-18 22:45 | 显示全部楼层

回复 #13 linqin1201 的帖子

什么意思呀 我不明白,这是时频图,和HHT谱图不一样啊

[ 本帖最后由 zhangnan3509 于 2007-4-18 22:50 编辑 ]
发表于 2007-4-18 23:38 | 显示全部楼层
原帖由 zhangnan3509 于 2007-4-18 22:45 发表
什么意思呀 我不明白,这是时频图,和HHT谱图不一样啊



HHT谱图也是时频图的一种啊,不过我对此没有太多研究,继续回到我的论文,呵呵
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-22 23:34 , Processed in 0.075130 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表