STA5107_FRADE_HW4

STA5107_FRADE_HW4 - STA5107 Dr Srivastava Homework 3 Jaime Frade 1 OUTPUT exp_x1 = 1.0190 var_x1 = 0.1315 STA5107 Dr Srivastava Homework 3 Jaime

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

View Full Document Right Arrow Icon
STA5107: Dr. Srivastava Homework 3 Jaime Frade 1. OUTPUT exp_x1 = 1.0190 var_x1 = 0.1315
Background image of page 1

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

View Full DocumentRight Arrow Icon
Dr. Srivastava Homework 3 Jaime Frade CODE clear all clc alpha=3; beta=0.8; x = -log(rand); for i=1:10000; y = -1*beta*log(rand); u1 = rand; fun1 = fun4_prob1(x,y,alpha,beta); if u1 <=fun1 x=y; else x=x; end ; x_1(i)=x; exp_x(i) = mean(x_1); var_x(i) = var(x_1); end ; figure(1) hist(x_1); xlabel( 'x - Values' ) ylabel( 'f(x)' ) title([ 'Histogram of values from Markov Chain' ]); saveas(figure(1),[ 'Histogram MC-Values prob1.png' ]) exp_x1 = mean(x_1) var_x1 = var(x_1) figure(2) func=@(x) x*x*abs(sin(pi*x))*exp(-abs(x)^3); fplot(func,[0,3]); title([ 'Density Function f(x)' ]); saveas(figure(2),[ 'Density Function prob1.png' ]) figure(3) plot(exp_x) xlabel( 'time' ) ylabel( 'E(x)' ) title([ 'Expected Value Convergence' ]); saveas(figure(3),[ 'Expected Convergence prob1.png' ]) figure(4) plot(var_x) xlabel( 'time' ) ylabel( 'Var(x)' ) title([ 'Variance Convergence' ]); saveas(figure(4),[ 'Variance Convergence prob1.png' ]) 2. OUTPUT
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/14/2011 for the course STAT 5107 taught by Professor Staff during the Fall '09 term at FSU.

Page1 / 14

STA5107_FRADE_HW4 - STA5107 Dr Srivastava Homework 3 Jaime Frade 1 OUTPUT exp_x1 = 1.0190 var_x1 = 0.1315 STA5107 Dr Srivastava Homework 3 Jaime

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

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