Announcement

Collapse
No announcement yet.

rambling -trembling

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • rambling -trembling

    Hy, anyone has matlab codes of rambling -trembling for an investigation for university?? thank you very much.best regards

  • #2
    Re: rambling -trembling

    Here is a matlab code for the estimation of the rambling-trembling trajectories.
    This code is 15 years old and you may have to change it according to your matlab version.

    I hope it helps

    Marcos Duarte


    function varargout = iep(varargin)
    %IEP processes the stabilogram decomposition according to IEP ideas
    % (Zatsiorsky & Duarte, 1999).
    % [IND,RAMBLING,TREMBLING,NIEP,T0,IEP0]=IEP(T,F,COP)
    % Inputs:
    % T: time time series [s]
    % F: horizontal force time series [N]
    % COP: center of pressure time series [mm]
    % Outputs:
    % IND: initial and final index in relation to the former T
    % for RAMBLING and TREMBLING time series
    % RAMBLING: rambling time series [mm]
    % TREMBLING: trembling time series [mm]
    % NIEP: number of IEP
    % T0: instants of IEP (by interpolation)
    % IEP0: IEP (by interpolation)
    % you should avoid use this code with unfiltered data
    %Marcos Duarte 5jul98


    if nargin ==3
    f=varargin{2};
    if length(varargin{1})==1
    freq=varargin{1};
    t=(1/freq:1/freq:length(f)/freq)';
    else
    t=varargin{1};
    freq=1/(t(2)-t(1));
    if size(t,1)==1
    t=t';
    end
    end
    cop=varargin{3};
    if size(cop,1)==1
    cop=cop';
    f=f';
    col=0;
    end
    else
    error('Incorrect number of inputs')
    return
    end

    %zero mean:
    f=f-mean(f);
    %find zeros:
    [ind,xzeros]=findzeros(t,f);
    xzeros=xzeros';
    %pick up data between first and last zero points:
    ini=floor(xzeros(1)*freq);
    fim=ceil(xzeros(end)*freq);
    if fim>length(t)
    fim=length(t);
    end
    ind=[ini fim];
    t=t(ini:fim);
    f=f(ini:fim);
    cop=cop(ini:fim);
    %IEP0 & IEP:
    iep0=interp1(t,cop,xzeros,'linear');
    iep=interp1(xzeros,iep0,t,'spline');
    %COPIEP:
    copiep=cop-iep;
    niep=length(xzeros)/(length(t)/freq);

    varargout{1}=ind;
    varargout{2}=iep;
    varargout{3}=copiep;
    varargout{4}=niep;
    varargout{5}=xzeros;
    varargout{6}=iep0;

    function varargout = findzeros(varargin)
    %FINDZEROS Find zeros in a vector.
    % IND=FINDZEROS(Y) finds the indices (IND) which are close to local zeros in the vector Y.
    % [IND,YZEROS]=FINDZEROS(X,Y), besides IND finds the values of local zeros (YZEROS) in the
    % vector X by linear interpolation of the vector Y.
    % Inputs:
    % X: vector
    % Y: vector
    % Outputs:
    % IND: indices of the zeros values in the vector Y
    % YZEROS: values in the vector X of zeros in the vector Y
    % Marcos Duarte mduarte@usp.br 11oct1998

    if nargin==1
    y=varargin{1};
    if size(y,2)==1
    y=y';
    end
    elseif nargin ==2
    x=varargin{1};
    y=varargin{2};
    if ~isequal(size(x),size(y))
    error('Vectors must have the same lengths')
    return
    elseif size(x,2)==1
    x=x'; y=y';
    end
    else
    error('Incorrect number of inputs')
    return
    end
    % find +- transitions (approximate values for zeros):
    %ind(i): the first number AFTER the zero value
    ind = sort( find( ( [y 0]<0 & [0 y]>0 ) | ( [y 0]>0 & [0 y]<0 ) ) );
    % find who is near zero:
    ind1=find( ( abs(y(ind)) - abs(y(ind-1)) )<= 0 );
    ind2=find( ( abs(y(ind)) - abs(y(ind-1)) )> 0 );
    indzero = sort([ind(ind1) ind(ind2)-1 find(y==0)]);
    varargout{1}=indzero;
    if exist('x')
    % find better approximation of zeros values using linear interpolation:
    yzeros=zeros(1,length(ind));
    for i=1:length(ind)
    p=polyfit( y(ind(i)-1:ind(i)),x(ind(i)-1:ind(i)),1 );
    yzeros(i)=polyval(p,0);
    end
    yzeros=sort([yzeros x(find(y==0))]);
    varargout{2}=yzeros;
    end
    Last edited by Marcos Duarte; August 20, 2013, 04:29 PM.

    Comment


    • #3
      Re: rambling -trembling

      thank you very much. best regards

      Comment

      Working...
      X