%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                          %
%     Creating an artifitial data set      %
%                                          %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

n_t=14; %number of time points
n_g=5;  %number of genes per cluster

mm=1;       % mean for the slope
msd=0.15;   % standard deviation for the slope
bm=0;1      % mean for the offset
bsd=1;      % standard deviation for the offset

%%%%%% Cluster 1
a=-fix(n_g/2);                      %initial value
m=random('norm',mm,msd,1,n_t);      %slope
b=random('norm',bm,bsd,1,n_t);      %offset
for i=1:n_g;                        %creat the n_t series for cluster 1
x1(i,1)=a;
for count=2:n_t
    x1(i,count)=m(count)*x1(i,count-1)+b(count);
end;
a=a+1;
end;

%%%%%%% Cluster 2
a=-fix(n_g/2);                      %initial value
m=random('norm',mm,msd,1,n_t);      %slope
b=random('norm',bm,bsd,1,n_t);      %offset
for i=1:n_g;                        %creat the n_t series for cluster 2
x2(i,1)=a;
for count=2:n_t
    x2(i,count)=m(count)*x2(i,count-1)+b(count);
end;
a=a+1;
end;

%%%%%%% Cluster 3
a=-fix(n_g/2);                      %initial value
m=random('norm',mm,msd,1,n_t);      %slope
b=random('norm',bm,bsd,1,n_t);      %offset
for i=1:n_g;                        %creat the n_t series for cluster 3
x3(i,1)=a;
for count=2:n_t
    x3(i,count)=m(count)*x3(i,count-1)+b(count);
end;
a=a+1;
end;

%%%%%%% Cluster 4
a=-fix(n_g/2);                      %initial value
m=random('norm',mm,msd,1,n_t);      %slope
b=random('norm',bm,bsd,1,n_t);      %offset
for i=1:n_g;                        %creat the n_t series for cluster 4
x4(i,1)=a;
for count=2:n_t
    x4(i,count)=m(count)*x4(i,count-1)+b(count);
end;
a=a+1;
end;

%%%%%%%%%%%% Plot all clusters 
t=(1:n_t);
subplot(2,2,1)
plot(x1');
subplot(2,2,2)
plot(x2');
subplot(2,2,3)
plot(x3');
subplot(2,2,4)
plot(x4');

figure
X=[x1;x2;x3;x4];
plot(X')





