simhwk8 - Estudiante: Vctor Gonzlez Matrcula: 805386...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Estudiante: Vctor Gonzlez Matrcula: 805386 Problema 1 =- = =- + i 1nxi x2 i 1nxi2 2xix x2 = =- = + = i 1nxi2 i 1n2xix i 1nx2 = =- = + = i 1nxi2 2xi 1nxi x2i 1n1 = =- ( )+ i 1nxi2 2x nx nx2 = =- i 1nxi2 nx2 Problema 2 VAR(X) = E[(x-) 2 ] VAR(X)=E[(x 2-2x+ 2 ] VAR(X)=E(x 2 )-2 E(x)+ 2 ] VAR(X)=E(x 2 )-2 E(x) E(x) + E(x) 2 ] VAR(X)=E(x 2 )-2 E(x) 2 + E(x) 2 ] VAR(X)=E(x 2 )- E(x) 2 ] ( )= = E X2 i 1nxi2 ( )= = = E X x i 1nxi ( ) = = = = = E X 2 i 1nx2 x2i 1n1 nx2 Problema 3 function [smean, svar]=exe7_3(X) %X es un vector de datos smean = X(1); %valor medio inicial svar = 0; %varianza inicial m = length(X); %tamao del vector for j=2:m smean_before = smean; %media anterior smean = smean + (X(j) - smean)/j; %media actual %varianza actual svar = (1-1/(j-1))*svar + j*(smean - smean_before)^2; end Results: >> X=rand(1000,1); >> [a b]=exe7_3(X) a = 0.5100 b = 0.0814 Estudiante: Vctor Gonzlez Matrcula: 805386 Problema 4 mu=0; sigma=1; %Generate a normal random variable %with mean 1 and stddev 2 sdev = 0.1; %condiciones iniciales mn = mu + sigma*randn(1); svar = 0; n=1; while (n<100 || (svar/n)>sdev^2) %hacer hasta 100 valores % o hasta que la desviacin estndar sea 0.01 mn_old = mn; mn = mn + (mu + sigma*randn(1) - mn)/n; %clculo de la media svar = (1-1/n)*svar+(n+1)*(mn-mn_old)^2; %clculo de la %varianza n=n+1; end disp([ 'Mean: ' ,num2str(mn)]) disp([ 'Variance: ' ,num2str(svar)]) disp([ 'TotalNorm: ' ,num2str(n)]) Results: Mean: -0.011007 Variance: 1.1571 TotalNorm: 117 a) La idea es generar n>100, se generaran 100 variables aleatorias. b) Se generaron 117 variables aleatorias. c) La media de los datos es -0.011007 d) La varianza de los datos es 1.1571 e) No dado que se parti del hecho de usar variables normal N(0,1 2 ) Problema 5 mu=0; Results: Estudiante: Vctor Gonzlez Matrcula: 805386 sigma=1; %Generate a normal random variable %with mean 1 and stddev 2 sdev = 0.01; %condiciones iniciales mn = mu + sigma*randn(1); svar = 0; n=1; while (n<100 || (svar/n)>sdev^2) %hacer hasta 100 valores % o hasta que la desviacin estndar sea 0.01 mn_old = mn; mn = mn + (mu + sigma*randn(1) - mn)/n; %clculo de la %media svar = (1-1/n)*svar+(n+1)*(mn-mn_old)^2; %clculo de la %varianza n=n+1; end disp([ 'Mean: ' ,num2str(mn)]) disp([ 'Variance: ' ,num2str(svar)]) disp([ 'TotalNorm: ' ,num2str(n)]) Mean: -0.0070278 Variance: 0.96897 TotalNorm: 9690 Estudiante: Vctor Gonzlez Matrcula: 805386 Problema 6 mn = exp(rand(1)^2); %condiciones iniciales sdev = 0.01; svar = 0; n=1; while (n<100 || (svar/n)>sdev^2) %hacer hasta 100 valores % o hasta que la desviacin estndar sea 0.01% o hasta que la desviacin estndar sea 0....
View Full Document

Page1 / 13

simhwk8 - Estudiante: Vctor Gonzlez Matrcula: 805386...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online