%% Historico Aula reposicao
a = [ 1 2; 3 4 ]
a(3)
a(1,2)
a(3,2)
home
[ a a ]
[ a; a ]
a * a
a
a .* a
a'
a(:)
a(1:end)
a(1:(end-1))
a(1:3)
1:3
home
path
mkdir aula_rep
cd aula_rep
help rand
rand
rand(1)
rand(2)
help rand
home
clear
r = randn( 1e5, 1 );
plot( r, '.' )
find( r>3 )
r( r>3 )
plot( r( r>3 ), '.r' )
help plot
home
clear
r = randn( 1e5, 1 );
plot( r, '.' )
r = randn( 1e3, 1 );
plot( r, '.' )
ind_1e2 = find( r>1 & r<2 )
r(7)
clear
home
r = randn( 1e3, 1 );
ind_1e2 = find( r>1 & r<2 );
figure
plot( r, '.k' )
hold on
plot( ind_1e2, r(ind_1e2), '.r' )
ind = find( (r>1 & r<2) | (r<-1 & r>-2) );
plot( ind, r(ind), 'og' )
home
clear
edit
clear
home
N = 10;
XY = rand(2,N);
XY = rand(2,N)
XY .^ 2
sum( XY .^ 2 )
clear
N = 1e4;
PIexp = 4 * mean( sum( rand(2,N).^2 )<1 )
clear
N = 1e4;
M = 100;
for i = 1 : M
PIexp(i) = 4 * mean( sum( rand(2,N).^2 )<1 );
end
std( PIexp )
mean( PIexp )
mean( PIexp ) - pi
plot( PIexp, '.' )
hold on
plot( [0 100], pi, '*-' )
plot( [1 100], pi, '*-' )
plot( [1 100], pi, '*-r' )
plot( [1 100], pi*[1 1], '*-r' )
plot( [1 100], (pi+std(PIexp))*[1 1], '--m' )
plot( [1 100], (pi-std(PIexp))*[1 1], '--m' )
clear
N = 1e4;
M = 10;
PIexp = 4 * mean( sum( rand(2,N,M).^2 )<1 );
N = 5
M = 3
rand(2,N,M).^2
sum( rand(2,N,M).^2 )
PIexp = 4 * mean( sum( rand(2,N,M).^2 )<1 )
clear
N = 1e4;
M = 100;
PIexp = 4 * mean( sum( rand(2,N,M).^2 )<1 );
std( PIexp )
mean( PIexp )
what
edit solucoes_exercicios_1a_aula_editado
what
edit triangulo
edit triangulo_Sierpinski.m
clear
N = 100e3;
figure
hold on
C(N) = 0;
% C = zeros(N,1);
C(1) = rand + 1i*rand;
tic
for i=1:(N-1)
regra = rand;
if regra<1/3
C(i+1) = C(i)/2;
elseif regra<2/3
C(i+1) = C(i)/2 + 1;
else
C(i+1) = C(i)/2 + 0.5 + 1i;
end
%    plot( C, '.k' )
end
toc
plot( C, '.k' )
edit triangulo_versao1.m
home
clear
[ C ] = triangulo_versao1( 1e6 );
plot( C, '.' )
figure
plot( C, '.' )
hold on
plot( C(1), 'or' )
edit triangulo.m
close all
home
what
edit fractal_feto.m
help fractal_feto
[ X, Y, R ] = fractal_feto( 1e5 );
figure, plot( X, Y, '.g', 'markersize', 1 )
hold on
plot( X(R==1), Y(R==1), '.r', 'markersize', 1 )
plot( X(R==2), Y(R==2), '.b', 'markersize', 1 )
plot( X(R==3), Y(R==3), '.k', 'markersize', 1 )
