%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 19h % para Atividade 02 - Ex. 1 x = 100 + 4*randn x = 100 + 6*randn x = 100 + 8*randn s = [ 4 6 8 10 12 14 16 18 20 ] s = [ 4:2:20 ] x = 100 + s .* randn( size(s) ) round( x ) % para Atividade 02 - Ex. 2 clear home x0 = 500 s = 50 x = x0 + s*randn(100,1); whos y = zeros(100,1); for n=1:100 y(n) = mean( x(1:n) ); end whos y(1:10) figure, plot( y, '*-r' ) hold on plot( [0 100], [500 500], '-k' ) x = x0 + s*randn(100,1); y = zeros(100,1); for n=1:100 y(n) = mean( x(1:n) ); end plot( y, '*-b' ) x = x0 + s*randn(100,1); y = zeros(100,1); for n=1:100 y(n) = mean( x(1:n) ); end plot( y, '*-g' ) x = x0 + s*randn(100,10); y = zeros( 100, 10 ); for n=1:100 y(n,1:10) = mean( x(1:n,1:10) ); end whos plot( y, '*-' ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 21h % para Atividade 02 - Ex. 1 home x = 100 + 4 * randn x = 100 + 6 * randn x = 100 + 8 * randn s = [ 4 6 8 10 12 14 16 18 20 ] s = [ 4:2:20 ] x = 100 + s .* randn( size(s) ) round( x ) round( 100 + s .* randn( size(s) ) ) % para Atividade 02 - Ex. 2 clear home x = 500 + 50 * randn(100,1); whos y = zeros( 100, 1 ); for n=1:100 y(n) = mean( x(1:n) ); end whos figure plot( y, '*-r' ) clear home x = 500 + 50 * randn(100,1); y = cumsum( 500 + 50*randn(1,100) ) ./ ( 1:100 ); plot( y, '*-r' ) hold on plot( cumsum( 500 + 50*randn(1,100) ) ./ ( 1:100 ), '*-b' ) plot( cumsum( 500 + 50*randn(1,100) ) ./ ( 1:100 ), '*-r' ) plot( cumsum( 500 + 50*randn(1,100) ) ./ ( 1:100 ), '*-g' ) plot( cumsum( 500 + 50*randn(1,100) ) ./ ( 1:100 ), '*-m' ) figure hold on for i=1:100 plot( cumsum( 500 + 50*randn(1,100) ) ./ ( 1:100 ), '*-c' ) end plot( cumsum( 500 + 50*randn(1,100) ) ./ ( 1:100 ), '*-r' )