tmp614.m

来自「信号分析与处理的一些源代码」· M 代码 · 共 46 行

M
46
字号
%MATLAB PROGRAM 6-14
%Application of Coherence Function
clf
%Case 1 : yx is dependent on xn
%==============================
%Create input signal
N=1024;
Nfft=256;
window=hanning(256);
noverlap=128;
dflag='none';
Fs=1000;
n=0:N-1;
t=n/Fs;
randn('state',0)
xn=sin(2*pi*50*t)+randn(1,N);
%Create a system: filter
h=ones(1,10)/10;
%Compute output signal
yn=filter(h,1,xn);
subplot(211)
cohere(xn,yn,Nfft,Fs,window,noverlap,dflag);
title('Yx is dependent on xn');
legend('Coherence Function ',4); 

%Case 2 : yx is independent on xn
%================================
%Create input signal
N=1024;
Nfft=256;
window=hanning(256);
noverlap=128;
dflag='none';
Fs=1000;
n=0:N-1;
t=n/Fs;
randn('state',0)
xn=ones(1,N);
yn=sin(2*pi*50*t);
subplot(212)
cohere(xn,yn,Nfft,Fs,window,noverlap,dflag);
title('Yx is independent on xn');
legend('Coherence Function ',4); 


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?