标题:帮忙!循环平稳的Matlab程序运行时的问题。
只看楼主
hetao256
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2008-8-29
 问题点数:0 回复次数:0 
帮忙!循环平稳的Matlab程序运行时的问题。
我在运行循环平稳的Matlab程序时,在Command Window窜口中显示
??? Error using ==> cyclic_cross_correlation
Incorrect number of arguments for function cyclic_cross_correlation

程序:function R=cyclic_cross_correlation(x,y,alpha,max_tau)
%
% CYCLIC_CROSS_CORRELATION
%              
%              calculates the cyclic cross correlation between
%              two signals x,y at frequency alpha
%            
%              R(k*alpha,tau)=E{x(t-tau/2)y(t+tau/2)exp(-jk(alpha)t)}
%              for k=0 ... 2*pi/alpha-1
%
% USAGE
%              R=cyclic_cross_correlation(x,y,alpha,max_tau)
%
%              calculate cross correlation up to max_tau time lags

% File: cyclic_cross_correlation.m
% Last Revised: 23/4/98
% Created: 24/11/97
% Author: Andrew C. McCormick
% (C) University of Strathclyde

% Simple error checks
if nargin~=4
  error('Incorrect number of arguments for function cyclic_cross_correlation');
end
if alpha>2*pi
  error('Cyclic frequency must be less than 2 pi in function cyclic_cross_correlation');
end


T=ceil(2*pi/alpha)-1;
lx=length(x);
t=0:lx-1;
R=zeros(max_tau*2+1,T+1);


% Compute even time shift segments
for tau=-max_tau:2:max_tau
  for k=0:T
    R(tau+1+max_tau,k+1)=mean(x(1:lx-max_tau-tau).*y(max_tau+tau+1:lx) ...
    .*exp(-j*k*alpha*t(1+(max_tau+tau)/2:lx-(max_tau+tau)/2)));
  end
end

% Compute odd time shift segments
t=t+0.5;
for tau=-max_tau+1:2:max_tau
  for k=0:T
    R(tau+1+max_tau,k+1)=mean(x(1:lx-tau-max_tau).*y(max_tau+tau+1:lx) ...
    .*exp(-j*k*alpha*t(1+(max_tau+tau-1)/2:lx-(max_tau+tau+1)/2)));
  end
end

谢谢高手帮忙看看
搜索更多相关主题的帖子: Matlab 运行 
2008-09-11 16:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-232724-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.096538 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved