% testsompi.m

% Save as 'testsompi.m' on the same directory with 'samplesompi.m'.

 

% making test data

 

N=125;

t=1:2*N+1;

f0=[1/10;1/15;1/20];

c0=[2 1.5 1];

g0=[-1/100;-1/150;-1/200];

phai0=[0; pi/4; pi/2];

 

xx=[];

for m=1:3

xx=[xx; c0(m)*(cos(2*pi*f0(m)*t+phai0(m)).*exp(g0(m)*t))];

end

xx=[xx;randn(size(t))*0.1];

x=sum(xx);

 

% Sompi analysis

% samplesompi(x,n)

% where x:data, n:AR order

 

ARORDER=10;

y=samplesompi(x,ARORDER)

 

% contents of y

% frequency, growing rate, initial amplitude, initial phase

 

figure(4)

clf reset;

rect=get(gca,'position'); clf reset;

NN=5;

for m=1:4

axes('position',[rect(1) rect(2)+rect(4)*(NN-(m+1))/NN rect(3) rect(4)/NN]);

plot(xx(m,:))

axis([0 256 -4 4]);

if m<4 set(gca,'xticklabels',[]); end

 

end

xlabel('Time /sec')

 

axes('position',[rect(1) rect(2)+rect(4)*(NN-1)/NN rect(3) rect(4)/NN]);

plot(x);axis([0 256 -4 4]);set(gca,'xticklabels',[]);

title('Data')