RANSY/RAMSY Matlab script

%%[RAMSYval,CORRval]=RAMSY(data,drivingnum)

%%data is a matrix. Each row is a sample, and each column is a variable.

%%drivingnum is the column number of the driving peak

%%RAMSYval is a matrix containing the RAMSY values between the driving peak and every other peak

%%the RAMSY value for the driving peak is the maximum of the RAMSYval matrix

%%CORRval is a matrix containing the correlation values between the driving peak and every peak

function [RAMSYval,CORRval]=RAMSY(data,drivingnum)

[rownum colnum]=size(data);

RAMSYval=ones(1,colnum);

CORRval=zeros(1,colnum);

ratiodata=zeros(rownum,colnum);

for j=1:colnum;

ratiodata(:,j)=data(:,j)./data(:,drivingnum);

end

for j=1:colnum

if j~=drivingnum

RAMSYval(1,j)=mean(ratiodata(:,j))/std(ratiodata(:,j));

end

end

RAMSYval(1,drivingnum)=max(RAMSYval);

for j=1:colnum;

tempcorr=corrcoef(data(:,j),data(:,drivingnum));

CORRval(1,j)=tempcorr(1,2);

end

RAMSYval=RAMSYval’;

CORRval=CORRval’;