声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3214|回复: 4

[工具箱] [求助]关于Hilbert变换

[复制链接]
发表于 2005-8-15 09:12 | 显示全部楼层 |阅读模式

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

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

x
在matlab中的hilbert函数经常出现虚部误差过大,请问能否改进?
回复
分享到:

使用道具 举报

发表于 2005-8-15 14:39 | 显示全部楼层

回复:(suffer)[求助]关于Hilbert变换

Hilbert 变换
在数学, Hilbert 变换 Hs (t) (并且写 s (t)) 真正的作用 s(t) 是积分式变换定义 n Hs (t) = s (t) = 1 - s ( )t- d n

就积分式而论作为避免稀有t =) 的Cauchy 主要价值(。

它可能并且被写与卷积操作员和: n s (t) = 1 t * s(t) n

s (t) 能被组建从 s(t) 由倍增其频率光谱 -i sgn( ), sgn 是的地方signum 作用和i 是虚数。这有转移所有的作用其消极频率由+90. 和所有正面频率根据 −90. 。注意Hilbert 变换并且原始的作用是两个同样可变物的作用。

Hilbert 变换有应用在信号处理。
发表于 2005-8-15 14:41 | 显示全部楼层

回复:(van321)回复:(suffer)[求助]关于Hilbert变...

我这里有一个C语言写的Hilbert 变换你看看对你是否有帮助。

来自于http://www.fysik.dtu.dk/~stoltze/tools/hilbert/hilbert.htm

/******************************************/
/* main.c
/******************************************/

#include <stdio.h>
#include <math.h>

#define N 500

#define sq(X) ((X)*(X))

int main()
{
int i;
double x;
double delta[N];
double kappa[N];
double y;
double xmin = -10.;
double xmax = 10.;
double cd = -1.;
double w = 2.;
double h = (xmax - xmin) / N;

for (i = 0; i < N; i++)
{
x = 2. * (xmin + i * h - cd) / w;
if (x < -1.)
delta[i1] = 0.;
else if (x < 1.)
delta[i1] = sqrt(1. - sq(x));
else
delta[i1] = 0.;
}

hilbert(n, delta, kappa);

for (i = 0; i < N; i++)
{
x = 2. * (xmin + i * h - cd) / w;
if (x < -1.)
y = x + sqrt(sq(x) - 1.);
else if (x < 1.)
y = x;
else
y = x - sqrt(sq(x) - 1.);
(void) printf("%.3f %.3f %.3f %.3f\n", xmin + i * h, delta, k
ppa, y);
}

return 0;
}

/******************************************/
/* hilbert.c
/******************************************/

void hilbert(int, double[], double[]);

/******************************************/
/* hilbert.c
/******************************************/
#include <stdio.h>

#include "hilbert.h"

#define PI 3.14159265

void hilbert(int n, double delta[], double kappa[])
{
double d1, d2, d3, d4;
int i1, i2;

for (i1 = 0; i1 < n; i1++)
{
kappa[i1] = 0.;
for (i2 = 1; i2 < n; i2++)
{
d1 = (i1+i2<N)? delta[i1+i2]: 0.;
d2 = (i1-i2>=0)? delta[i1-i2]: 0.;
d3 = (i1+i2+1<N)? delta[i1+i2+1]: 0.;
d4 = (i1-i2-1>=0)? delta[i1-i2-1]: 0.;

kappa[i1] -= 0.5 * (d1-d2) / i2 + 0.5 * (d3 - d4) / (i2
1);
}
kappa[i1] /= PI;
}
}
/***********************************************
/* 说明
/***********************************************

The Hilbert transform
This package performs a numerical Hilbert transform.
Download Compressed tar-file
or
hilbert.c and hilbert.h


Header file
The program must include the header file
#include "hilbert.h"
/***********************************************
/* 说明
kappa[i1] -= 0.5 * (d1-d2) / i2 + 0.5 * (d3 - d4) / (i2
1);
}
kappa[i1] /= PI;
}
}
/***********************************************
/* 说明
/***********************************************

The Hilbert transform
This package performs a numerical Hilbert transform.
Download Compressed tar-file
or
hilbert.c and hilbert.h


Header file
The program must include the header file
#include "hilbert.h"

and then call hilbert() to perform the transform.

Usage
If delta and kappa are arrays of n doubles, both arrays are allocated by the mai
program.
The input data are in delta and the call hilbert(n, delta, kappa) will return th
Hilbert transform of delta in kappa.

n and delta are not modified.

Compilation
Compile the package using a C-compiler.
If you use a makefile and this makefile looks like this

a.out: a.o b.o c.o
cc a.o b.o c.o
...
a. a.c d.h
cc -c a.c
...

and you use the package in a.c, change the makefile to look like this
a.out: a.o b.o c.o hilbert.o
cc a.o b.o c.o hilbert.o
...
a. a.c d.h hilbert.h
cc -c a.c
...
hilbert. hilbert.c hilbert.h
cc -c hilbert.c

Demo
main.c uses the package to perform a Hilbert transform of a semi-ellipsis.
Output from the program is a table.

First column: x
Second column: The semi-ellipsis
Third column: The Hilbert transform calculated by hilbert().
Fourth column: The analytical Hilbert transform of the semi-ellipsis.
 楼主| 发表于 2005-8-21 09:11 | 显示全部楼层
改写过去也挺麻烦,不过谢谢啦,我试试看,不知道还有没有其他更方便点的方法?
发表于 2005-8-23 16:31 | 显示全部楼层
我想用hilbert做包络检测<BR>那位做过
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-5-6 17:20 , Processed in 0.050133 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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