synchronous_average.m
来自「基于参数和非参数的多种频谱检测算法研究及仿真结果分析。」· M 代码 · 共 66 行
M
66 行
function m=synchronous_average(x,T)%% SYNCHRONOUS_AVERAGE% calculate the synchronous average of the signal x% with period T%% USAGE% m=synchronous_average(x,T)%% if T is a scalar, then T defined the fundamental% cyclic period%% if T is a vector, then T defines a series of once% per revolution impulses% File: synchronous_average.m% Last Revised: 24/11/97% Created: 24/11/97% Author: Andrew C. McCormick% (C) University of Strathclyde% Simple error checksif nargin~=2 error('Incorrect number of arguments for function synchronous_average');endif T(1)<1 error('Synchronous period must be larger than 1 in function synchronous average');end% Remove excess samples due to non-integer samplingif length(T)==1 % remove jitter samples if non-integer T if T~=floor(T) cp=1;np=1; while cp+T<length(x) cp=cp+floor(T); np=np+T; if (np-cp)>1 x=[x(1:cp-1) x(cp+1:length(x))]; np=np-1; end end end n=floor((length(x)-1)/T);else % extract time series correlated with periodic pulses rot_positions=T; T=floor(median(diff(rot_positions))); nx=[]; n=length(rot_positions)-2; for k=1:n; cp=rot_positions(k); nx=[nx; x(cp:cp+T-1)]; end x=nx;endtemp=zeros(floor(T),n);t=(1:floor(T)*n);temp(:)=x(t);m=mean(temp');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?