声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

楼主: tjucruiser

[HHT] 请问安装EMD工具包时,缺少一个文件怎么解决啊?

[复制链接]
发表于 2008-5-9 10:42 | 显示全部楼层

回复 15楼 的帖子

我电脑上现在没有VC++,百度了一下
不知道是不是这个
http://forum.vibunion.com/forum/ ... 64009&page=1###

/* @(#) complex.h 1.4 1/27/86 17:46:35 */
/*ident        "@(#)cfront:incl/complex.h        1.4"*/
#include <stream.h>
#include <errno.h>

overload cos;
overload cosh;
overload exp;
overload log;
overload pow;
overload sin;
overload sinh;
overload sqrt;
overload abs;

#include <math.h>
inline double abs(double d) { return fabs(d); }

class complex {
        double        re, im;
public:
        complex(double r = 0, double i = 0)        { re=r; im=i; }
                
        friend        double        real(complex&);
        friend        double        imag(complex&);

        friend        double        abs(complex);
        friend  double  norm(complex);
        friend  double        arg(complex);
        friend  complex conj(complex);
        friend  complex cos(complex);
        friend  complex cosh(complex);
        friend        complex exp(complex);
        friend  complex log(complex);
        friend  complex pow(double, complex);
        friend        complex pow(complex, int);
        friend        complex pow(complex, double);
        friend        complex pow(complex, complex);
        friend  complex        polar(double, double = 0);
        friend  complex sin(complex);
        friend  complex sinh(complex);
        friend        complex sqrt(complex);

        friend        complex        operator+(complex, complex);
        friend        complex        operator-(complex);
        friend        complex operator-(complex, complex);
        friend        complex operator*(complex, complex);
        friend         complex operator/(complex, complex);
        friend         int        operator==(complex, complex);
        friend         int        operator!=(complex, complex);
       
        void operator+=(complex);
        void operator-=(complex);
        void operator*=(complex);
        void operator/=(complex);
};

ostream& operator<<(ostream&, complex);
istream& operator>>(istream&, complex&);

extern int errno;

inline double real(complex& a)
{
        return a.re;
}

inline double imag(complex& a)
{
        return a.im;
}

inline complex operator+(complex a1, complex a2)
{
        return complex(a1.re+a2.re, a1.im+a2.im);
}

inline complex operator-(complex a1,complex a2)
{
        return complex(a1.re-a2.re, a1.im-a2.im);
}

inline complex operator-(complex a)
{
        return complex(-a.re, -a.im);
}

inline complex conj(complex a)
{
        return complex(a.re, -a.im);
}

inline int operator==(complex a, complex b)
{
        return (a.re==b.re && a.im==b.im);
}

inline int operator!=(complex a, complex b)
{
        return (a.re!=b.re || a.im!=b.im);
}

inline void complex.operator+=(complex a)
{
        re += a.re;
        im += a.im;
}

inline void complex.operator-=(complex a)
{
        re -= a.re;
        im -= a.im;
}


static const complex complex_zero(0,0);

class c_exception
{
        int        type;
        char        *name;
        complex        arg1;
        complex        arg2;
        complex        retval;
public:

        c_exception( char *n, complex a1, complex a2 = complex_zero )
                { name = n; arg1 = a1; arg2 = a2; type = 0; retval = 0; }

        friend int complex_error( c_exception& );

        friend complex exp( complex );
        friend complex sinh( complex );
        friend complex cosh( complex );
        friend complex log( complex );       
};

评分

1

查看全部评分

回复 支持 反对
分享到:

使用道具 举报

发表于 2008-5-9 10:44 | 显示全部楼层

回复 16楼 的帖子

我也想知道第3步有什么样的显示,出了什么问题
 楼主| 发表于 2008-5-9 10:56 | 显示全部楼层
第三步
install_emd
cemdc.c
cemdc.c(19) : fatal error C1083: Cannot open include file: 'complex.h': No such file or directory

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc.c' failed.

cemdc.c
clocal_mean.c(58) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc.c' failed.

cemdc_fix.c
cemdc_fix.c(19) : fatal error C1083: Cannot open include file: 'complex.h': No such file or directory

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc_fix.c' failed.

cemdc_fix.c
clocal_mean.c(58) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc_fix.c' failed.

cemdc2.c
cemdc2.c(19) : fatal error C1083: Cannot open include file: 'complex.h': No such file or directory

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2.c' failed.

cemdc2.c
clocal_mean2.c(62) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2.c' failed.

cemdc2_fix.c
cemdc2_fix.c(19) : fatal error C1083: Cannot open include file: 'complex.h': No such file or directory

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2_fix.c' failed.

cemdc2_fix.c
clocal_mean2.c(62) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2_fix.c' failed.

Warning: The compilation of the following files failed:
> In make_emdc at 48
  In install_emd at 26
cemdc.c
cemdc_fix.c
cemdc2.c
cemdc2_fix.c

Some errors occurred during compilation. See details above.

Installation complete. Run index_emd for a list of functions.

IMPORTANT: After running INSTALL_EMD you must run the "savepath" command to save the installation
but be careful that if you previously removed parts of the path (using e.g. the "rmpath" command)
these will be permanently removed after you run "savepath"
 楼主| 发表于 2008-5-9 11:00 | 显示全部楼层
加上您的那个文件之后,显示
install_emd
cemdc.c
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\complex.h(3) : fatal error C1083: Cannot open include file: 'stream.h': No such file or directory

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc.c' failed.

cemdc.c
clocal_mean.c(58) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc.c' failed.

cemdc_fix.c
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\complex.h(3) : fatal error C1083: Cannot open include file: 'stream.h': No such file or directory

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc_fix.c' failed.

cemdc_fix.c
clocal_mean.c(58) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc_fix.c' failed.

cemdc2.c
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\complex.h(3) : fatal error C1083: Cannot open include file: 'stream.h': No such file or directory

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2.c' failed.

cemdc2.c
clocal_mean2.c(62) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2.c' failed.

cemdc2_fix.c
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\complex.h(3) : fatal error C1083: Cannot open include file: 'stream.h': No such file or directory

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2_fix.c' failed.

cemdc2_fix.c
clocal_mean2.c(62) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2_fix.c' failed.

Warning: The compilation of the following files failed:
> In make_emdc at 48
  In install_emd at 26
cemdc.c
cemdc_fix.c
cemdc2.c
cemdc2_fix.c

Some errors occurred during compilation. See details above.

Installation complete. Run index_emd for a list of functions.

IMPORTANT: After running INSTALL_EMD you must run the "savepath" command to save the installation
but be careful that if you previously removed parts of the path (using e.g. the "rmpath" command)
these will be permanently removed after you run "savepath"
发表于 2008-5-9 11:02 | 显示全部楼层
IMPORTANT: After running INSTALL_EMD you must run the "savepath" command to save the installation
but be careful that if you previously removed parts of the path (using e.g. the "rmpath" command)
these will be permanently removed after you run "savepath"

是不是要把您安装EMD的目录 保存一下,以后这个EMD文件夹里面的程序就可以直接调用了。用savepath来完成
 楼主| 发表于 2008-5-9 11:05 | 显示全部楼层
但是那么多出错的问题没有编译通过,请问您是用什么编译器的,从哪里可以下载,多谢了
发表于 2008-5-9 11:07 | 显示全部楼层

回复 22楼 的帖子

我以前安装的时候根本就没出过问题。MATLAB是7.1版,VC++是6.0,按照上面的步骤很顺利。

建议楼主也可以尝试运行一个主程序,看看是不是能行。

[ 本帖最后由 zhangnan3509 于 2008-5-9 11:10 编辑 ]
 楼主| 发表于 2008-5-9 11:09 | 显示全部楼层
我查了VC中有complex文件,没有后缀,然后我看到一些VC程序,里面写的包含是
#include <complex>
而不是
#include <complex.h>
我尝试复制一个complex文件,并重命名为complex.h,结果提示
install_emd
cemdc.c
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\eh.h(32) : fatal error C1189: #error :  "eh.h is only for C++!"  

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc.c' failed.

cemdc.c
clocal_mean.c(58) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc.c' failed.

cemdc_fix.c
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\eh.h(32) : fatal error C1189: #error :  "eh.h is only for C++!"  

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc_fix.c' failed.

cemdc_fix.c
clocal_mean.c(58) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc_fix.c' failed.

cemdc2.c
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\eh.h(32) : fatal error C1189: #error :  "eh.h is only for C++!"  

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2.c' failed.

cemdc2.c
clocal_mean2.c(62) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2.c' failed.

cemdc2_fix.c
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\eh.h(32) : fatal error C1189: #error :  "eh.h is only for C++!"  

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2_fix.c' failed.

cemdc2_fix.c
clocal_mean2.c(62) : error C2065: 'M_PI' : undeclared identifier

  D:\MATLAB71\BIN\MEX.PL: Error: Compile of 'cemdc2_fix.c' failed.

Warning: The compilation of the following files failed:
> In make_emdc at 48
  In install_emd at 26
cemdc.c
cemdc_fix.c
cemdc2.c
cemdc2_fix.c

Some errors occurred during compilation. See details above.

Installation complete. Run index_emd for a list of functions.

IMPORTANT: After running INSTALL_EMD you must run the "savepath" command to save the installation
but be careful that if you previously removed parts of the path (using e.g. the "rmpath" command)
these will be permanently removed after you run "savepath"
 楼主| 发表于 2008-5-9 11:10 | 显示全部楼层
那难道这个EMD工具包有问题?
 楼主| 发表于 2008-5-9 11:17 | 显示全部楼层
我试着运行您贴的一段代码,最后运行结果如下:
t=1:500;
t=t*1/2000;
x=sin(2*pi*20*t);
y=0.4*sin(2*pi*40*t+140);
z=x+y;
plot(t,z)

imf=emd(z);
emd_visu(z,1:length(z),imf)

[A,f,tt]=hhspectrum(imf);
[im,tt]=toimage(A,f);
disp_hhs(im);
colormap(flipud(gray))
??? Undefined command/function 'instfreq'.

Error in ==> hhspectrum at 79
  f(i,:)=instfreq(an(i,:)',tt,l)';
发表于 2008-5-9 11:21 | 显示全部楼层

回复 26楼 的帖子

这是缺少instfreq函数。
以前的帖子里也有类似的问题
http://forum.vibunion.com/forum/thread-43238-1-24.html

现在应该有新的EMD安装的版本,可以重新下载。

[ 本帖最后由 zhangnan3509 于 2008-5-9 11:23 编辑 ]
发表于 2008-5-9 11:26 | 显示全部楼层
原帖由 tjucruiser 于 2008-5-9 11:17 发表
我试着运行您贴的一段代码,最后运行结果如下:
t=1:500;
t=t*1/2000;
x=sin(2*pi*20*t);
y=0.4*sin(2*pi*40*t+140);
z=x+y;
plot(t,z)

imf=emd(z);
emd_visu(z,1:length(z),imf)

[A,f,tt]=hhspectrum( ...
不要一个劲地发问,你看今天你发了n多帖子,要养成遇到问题先自己尝试解决的习惯
 楼主| 发表于 2008-5-9 15:29 | 显示全部楼层

关于#include <complex.h>问题的解决?也许是对的,请高手指正

我现在改了一下工具包中src文件夹下的程序代码,而后安装,安装之后只有一个错误提示:
D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\eh.h(32) : fatal error C1189: #error :  "eh.h is only for C++!"  
查了一下,eh.h是error handle exception文件,用于处理异常抛出问题解决的,应该没有太大关系。
修改后,现在运行您上面的程序没有出错,我把修改后的内容列出来,供大家一起探讨。

原来在src文件夹下的前4个文件,都有这样的包含语句:#include <complex.h>
但是在Vc中是不存在这个头文件的,但是有一个叫做COMPLEX的文件,用VC打开后,发现
Complex是复数类,是一个属于STL的头文件,要包含这种文件,出了include还需要命名空间,所以最后,我把那句include语句修改为:
# include<complex>
using namespace std;
目前运行程序没有大的问题,请各位高手指点!
发表于 2008-5-10 15:00 | 显示全部楼层

关于EMD的安装问题探讨

我也在安装EMD遇到类似的问题但现在发现,安装程序里有一些文件本身就有问题!
更详细的情况想和你探讨下。
我的qq66963783
请楼上看到加我啊
发表于 2008-5-11 15:51 | 显示全部楼层
多谢版主和几位师兄,我学到了不少东西!
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-11-29 12:59 , Processed in 0.069825 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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