声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3839|回复: 5

[其他] 关于相干函数的讨论!

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

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

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

x
请教大家一个问题,我现在想通过相干函数对两个信号之间的相关性进行分析,采用的是matlab中的cohere函数,Cxy = cohere(x,y,nfft,fs,window,numoverlap),但在使用这个函数的过程中,我发现函数带有的参数对分析的结果有很大影响,尤其是其中窗口的宽度及numoverlap,即两窗口之间重叠的点数,这两个参数对结果有很大影响,见下图。不知大家是怎么处理这个问题的?参数是怎么选择的?

相干函数对比图

相干函数对比图
回复
分享到:

使用道具 举报

发表于 2007-7-30 17:38 | 显示全部楼层
help cohere
COHERE Coherence function estimate.
    COHERE has been replaced by MSCOHERE.  COHERE still works but may be
    removed in the future. Use MSCOHERE instead.

    MSCOHERE does not support detrending.  Please use the DETREND function
    if you need to detrend your signal.  Type "help detrend" for details.

评分

1

查看全部评分

 楼主| 发表于 2007-7-30 19:42 | 显示全部楼层
您好,我用的matlab是6.5的版本,请问您提到的MSCOHERE 这个函数是在哪个版本上有呢?麻烦您了。
发表于 2007-7-30 21:18 | 显示全部楼层
我的是7.0.4,没有用过那个函数,所以看了一下help,结果就出了那个东西
 楼主| 发表于 2007-7-30 21:44 | 显示全部楼层
看来是版本太低的事,改天装个7.0试试。呵呵,谢谢你了。
发表于 2008-10-15 10:22 | 显示全部楼层

回复 5楼 mofei 的帖子

mscohere
Magnitude squared coherence

      Syntax
   Cxy=mscohere(x,y)Cxy=?mscohere(x,y,window)Cxy=mscohere(x,y,window,noverlap)[Pxy,W]=mscohere(x,y,window,noverlap,nfft)[Cxy,F]=mscohere(x,y,window,noverlap,nfft,fs)[...]=mscohere(x,y,...,'whole')mscohere(...)DescriptionCxy=mscohere(x,y) finds
the magnitude squared coherence estimate Cxy of the input signals x and y using
Welch's averaged, modified periodogram method. The magnitude squared coherence
estimate is a function of frequency with values between 0 and 1 that indicates
how well x corresponds to y at each
frequency. The coherence is a function of the power spectral density (Pxx and Pyy)
of x andy and the
cross power spectral density (Pxy) of x and y.
x and y must be the same length.
For real x and y, mscohere returns
a one-sided coherence estimate and for complex x or y,
it returns a two-sided estimate.mscohere uses the following default values: ParameterDescriptionDefault
Value
nfftFFT length which determines the frequencies at which the coherence
is estimatedFor real x and y,
the length of Cxy is (nfft/2+1) if nfft is
even or (nfft+1)/2 if nfft is odd. For
complex x or y, the length of Cxy is nfft.If nfft is greater than the signal length, the data is zero-padded. If nfft is
less than the signal length, the segment is wrapped using datawrap so that
the length is equal to nfft.Maximum of 256 or the next power of 2 greater than the length
of each section of x or y
fsSampling frequency1
windowWindowing function and number of samples to use for each sectionPeriodic Hamming window of length to obtain eight equal sections
of x and y
noverlapNumber of samples by which the sections overlapValue to obtain 50% overlap
Note??


You can use the empty matrix [] to specify the default
value for any input argument except x or y.
For example, Pxy = mschoere(x,y,[],[],128) uses a Hamming
window, default noverlap to obtain 50% overlap, and the
specified 128 nfft.Cxy?=?mscohere(x,y,window) specifies
a windowing function, divides x and y into
equal overlapping sections of the specified window length, and windows each
section using the specified window function. If you supply a scalar for window, Cxy uses
a Hamming window of that length. mscohere zero pads the
sections if the window length exceeds nfft.Cxy?=?mscohere(x,y,window,noverlap) overlaps
the sections of x by noverlap samples. noverlap must
be an integer smaller than the length of window.[Pxy,W]?=?mscohere(x,y,window,noverlap,nfft) uses
the specified FFT length nfft to calculate the coherence
estimate. It also returns W, which is the vector of normalized
frequencies (in rad/sample) at which the coherence is estimated. For real x and y, Cxy length
is (nfft/2 +1) if nfft is even and if nfft is
odd, the length is (nfft+1)/2. For complex x or y,
the length of Cxy is nfft. For real
signals, the range of W is [0,?pi] when nfft is
even and [0,?pi) when nfft is odd. For
complex signals, the range of W is [0,?2*pi).[Cxy,F]?=?mscohere(x,y,window,noverlap,nfft,fs) returns Cxy as a function of frequency
and a vector F of frequencies at which the coherence is
estimated. fs is the sampling frequency in Hz. For real
signals, the range of F is [0,?fs/2]
when nfft is even and [0,?fs/2)
when nfft is odd. For complex signals, the range of F is
[0,?fs).[...]?=?mscohere(x,y,...,'whole') returns a coherence estimate with frequencies that range over the whole
Nyquist interval. Specifying 'half' uses half the Nyquist
interval.mscohere(...) plots the magnitude
squared coherence versus frequency in the current figure window. Note??


If you use mscohere on two linearly related signals [1]with a single, non-overlapping window, the
output for all frequencies is Cxy = 1.ExamplesCompute and plot the coherence estimate between two colored noise sequences x and y:randn('state',0);
h = fir1(30,0.2,rectwin(31));
h1 = ones(1,10)/sqrt(10);
r = randn(16384,1);
x = filter(h1,1,r);
y = filter(h,1,x);
mscohere(x,y,hanning(1024),512,1024)

Algorithmmscohere estimates the magnitude squared coherence
function [2] using Welch's averaged periodogram
method (see references [3] and [4]).References[1]  Stoica, P., and R. Moses. Introduction
to Spectral Analysis. Upper Saddle River, NJ: Prentice-Hall, 1997.
Pgs.61-64.[2] Kay, S.M. Modern Spectral Estimation. Englewood
Cliffs, NJ: Prentice-Hall, 1988. Pg.454.[3] Rabiner, L.R., and B. Gold. Theory
and Application of Digital Signal Processing. Englewood Cliffs,
NJ: Prentice-Hall, 1975.[4] Welch, P.D. "The Use of Fast Fourier Transform
for the Estimation of Power Spectra: A Method Based on Time Averaging Over
Short, Modified Periodograms." IEEE Trans. Audio Electroacoust.
Vol. AU-15 (June 1967). Pgs.70-73.
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-11-26 13:52 , Processed in 0.087672 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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