s = 1;
x0 = 10;
N = 15;
X = x0 + s * randn(N,1)
doc randn
RandStream.setDefaultStream
(RandStream('mt19937ar','seed',sum(100*clock)));
RandStream.setDefaultStream
(RandStream('mt19937ar','seed',sum(100*clock)));
RandStream.setDefaultStream(RandStream('mt19937ar','seed',sum(100*clock)));
RandStream.setDefaultStream
(RandStream('mt19937ar','seed',sum(100*clock)));
RandStream.setDefaultStream(RandStream('mt19937ar','seed',sum(100*clock)));
home
X = x0 + s * randn(N,1)
xm = mean( X )
sx = std( X )
figure
errorbar(X,sx,'.')
errorbar(X, sx*ones(N,1) ,'.')
plot(X,'*')
errorbar(X, sx*ones(N,1) ,'.')
hold on
plot( [0 16], xm*[1 1], '-r' )
plot( [0 16], (xm+sx/sqrt(N))*[1 1], '--m' )
plot( [0 16], (xm-sx/sqrt(N))*[1 1], '--m' )
clear
hom
home
xm = gera_xm
clear
home
for j=1:1000
xm(j) = gera_xm;
end
for j=1000:-1:1
xm(j) = gera_xm;
end
figure, plot( xm, '*' )
std( xm )
1/sqrt(15)
clear
home
N = 15;
a0 = 1;
b0 = 2;
x = (1:N);
Y0 = a0 + b0 * x;
s = 1;
Y = Y0 + s*randn( size(Y0) )
figure
errorbar( x, Y, s*ones(size(Y)), '.' )
help polyfit
P = polyfit( x, Y, 1 )
[ at, bt ] = gera_reta
for j=1000:-1:1
[ at(j), bt(j) ] = gera_reta;
end
figure, plot( at, '*' )
std( at )
figure, plot( bt, '*' )
std( bt )
figure, plot( at, bt, '.' )
help corrcoef
corrcoef( at, bt )
for j=1000:-1:1
[ at(j), bt(j) ] = gera_reta(8);
end
std(at)
std(bt)
figure, plot( at, bt, '.' )
corrcoef( at, bt )
