📄 synchronous_average.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -