clear all;
close all;
for j=[2,3,1]
    n = 10^j;
    ni = 1/n;
t(:,1)=0:ni:1;
% xs- x signal
xs = sin(2*pi*t);
xs = xs ./ std(xs,1);

for i=1:6
    % r- correlation coefficient
    r = (i-1)*.2;
    % e - noise
    e = sqrt(1-r*r)*randn(n+1,1);
    x(:,i) = r .* xs + e;
    figure(n+i)
    plot(t,xs,'r',t,x(:,i),'c')
end

xm = mean(x);
xsd = std(x,1);
c = corr(x);
figure(n+7)
[h,ax,bax,p]=plotmatrix(x);
pause

xma(:,j) = xm;
xsda(:,j) = xsd;
ca(:,:,j) = c;
clear t xs xss e x
end
    
