%% Test FAMS on 1D data

%% randomize data
max_uniform=100;
vect1 = rand(1000,1)*max_uniform; % uniform 
vect2 = randn(100,1)*3+20; %first gauss 
vect3 = randn(100,1)*3+60; %second gauss 
data=[vect1;  vect2; vect3];

%% run FAMS
[modes,p_modes,w_modes ] =fams(data,20,15,100,'exmpl1D','res/','-h',10);

%% view results
p_modes
figure(1),clf;
subplot(2,2,1),plot(data,'*'),title('1D data (x:sample num, y:value)');
subplot(2,2,2),plot(modes,'*'),title('after fams');
[f,xi]=ksdensity(modes,'width',2);
subplot(2,2,3),plot(xi,f,'.g');
subplot(2,2,4),hist(modes,10);

% p_modes =
%   420.0000   19.9799
%   386.0000   59.2612
%   121.0000   43.4002
%   114.0000   83.6234
%    88.0000   92.7286
%    71.0000   75.0310