0 views

Uploaded by Shaggypatel

My probability homework

- MLC Preparation Notes
- Introduction to R - Guy Yollin - Uni of Washington
- python_crash_course
- SIMD Nested Conditionals
- AU2
- Php w3 School
- Introduction to Econometrics with R
- Sysadmin
- Chapter 3 - Fundamentals of Programming Language
- ch3
- Synthesizing Latches Doulos
- ec079
- Assignment #1 (1)
- Chapter 13
- FP201 3.Prog Control
- 7cd7e4162b62e3f4c308bfb303a7f973_march-25-notes-.docx
- MSc_SA&L_L03_ReliabilityNotes_2008_2009[1]
- 1a. UI STAT S1 week 1 0205 handout.pdf
- 68380_toc
- Section 8b Peussdistributions 2 Slides Compatibility Mode

You are on page 1of 10

(B)

MATLAB Code:

clear all;

clc;

close all;

% Ask user for a number of random numbers to generate.

userPrompt = 'Enter an integer number of random numbers to generate';

caNumberOfRandoms = inputdlg(userPrompt, 'Enter an integer',1, {'100000'});

numberOfRandoms = str2num(cell2mat(caNumberOfRandoms));

%Plot Empirical CDF

k=asin(2*rand(1,numberOfRandoms)-1);

cdfplot(k);

Empirical CDF

1

0.9

0.8

0.7

F(x)

0.6

0.5

0.4

0.3

0.2

0.1

0

-2

-1.5

-1

-0.5

0

x

0.5

1.5

(D)

MATLAB Code:

clear all;

clc;

close all;

k=cell(1000,1);

sample_mean=[];

case_number=1;

N=1;

iteration=1000;

z=1;

%

%

%

%

Number of random variables

1000 iteration for each N

Figure number

%Here, the expected value is zero, so diatance between that and sample mean

would be

%sample mean itself

for case_number=1:1:6

for iteration=1:1000

if case_number == 1

N=1;

elseif case_number ==2

N=10;

elseif case_number ==3

N=100;

elseif case_number ==4

N=1000;

elseif case_number ==5

N=10000;

else

N=100000;

end

k{iteration,1}=asin(2*rand(1,N)-1);

sample_mean(1,iteration)=mean(k{iteration,1});

figure(z);

end

cdfplot(sample_mean);

%cdfplot for each of 6 case

z=z+1;

end

The figures for each case have been plotted in the next pages.

Case: 1: N=1

Empirical CDF

1

0.9

0.8

0.7

F(x)

0.6

0.5

0.4

0.3

0.2

0.1

0

-2

-1.5

-1

-0.5

0

x

0.5

1.5

0.2

0.4

0.6

0.8

Case: 2: N=10

Empirical CDF

1

0.9

0.8

0.7

F(x)

0.6

0.5

0.4

0.3

0.2

0.1

0

-0.8

-0.6

-0.4

-0.2

0

x

Case: 3: N=100

Empirical CDF

1

0.9

0.8

0.7

F(x)

0.6

0.5

0.4

0.3

0.2

0.1

0

-0.25

-0.2

-0.15

-0.1

-0.05

0

x

0.05

0.1

0.15

0.2

0.25

Case: 4: N=1000

Empirical CDF

1

0.9

0.8

0.7

F(x)

0.6

0.5

0.4

0.3

0.2

0.1

0

-0.08

-0.06

-0.04

-0.02

0

x

0.02

0.04

0.06

0.08

Case: 5: N=10000

Empirical CDF

1

0.9

0.8

0.7

F(x)

0.6

0.5

0.4

0.3

0.2

0.1

0

-0.025 -0.02 -0.015 -0.01 -0.005

0

x

0.005

0.01

0.015

0.02

0.025

Case: 6: N=100000

Empirical CDF

1

0.9

0.8

0.7

F(x)

0.6

0.5

0.4

0.3

0.2

0.1

0

-8

-6

-4

-2

0

x

8

-3

x 10

(E)

MATLAB Code:

clear all;

clc;

close all;

% Ask user for a number of sets of random numbers to generate

userPrompt_one = 'Enter an integer number of sets of random numbers';

caSets = inputdlg(userPrompt_one, 'Enter an integer',1, {'100000'});

K = str2num(cell2mat(caSets));

% Ask user for a number of random numbers to generate.

userPrompt_two = 'Enter an integer number of random numbers to generate';

caNumberOfRandoms = inputdlg(userPrompt_two, 'Enter an integer',1,

{'100000'});

L = str2num(cell2mat(caNumberOfRandoms));

k=cell(K,1);

sample_mean=[];

%Here, the expected value is zero, so diatance between that and sample mean

would be

%sample mean itself

for iteration=1:K

k{iteration,1}=asin(2*rand(1,L)-1);

sample_mean(1,iteration)=(sum(k{iteration,1}))/sqrt(L);

end

figure(1);

cdfplot(sample_mean);

figure(2);

hist(sample_mean);

Figures of HISTIGRAM and CDF for three different values of L and K have

been given on the next pages.

1)L=10000, K=1000;

250

200

150

100

50

0

-2.5

-2

-1.5

-1

-0.5

0.5

1.5

2.5

Empirical CDF

1

0.9

0.8

0.7

F(x)

0.6

0.5

0.4

0.3

0.2

0.1

0

-3

-2

-1

0

x

2) L=1000, K =1000

250

200

150

100

50

0

-2

-1.5

-1

-0.5

0.5

1.5

2.5

1.5

2.5

Empirical CDF

1

0.9

0.8

0.7

F(x)

0.6

0.5

0.4

0.3

0.2

0.1

0

-2

-1.5

-1

-0.5

0.5

x

3) L = 100, K = 100

9

8

7

6

5

4

3

2

1

0

-1.5

-1

-0.5

0.5

1.5

0.5

1.5

Empirical CDF

1

0.9

0.8

0.7

F(x)

0.6

0.5

0.4

0.3

0.2

0.1

0

-1.5

-1

-0.5

0

x

distribution approaches Normal Distribution.

- MLC Preparation NotesUploaded bySasha Woodroffe
- Introduction to R - Guy Yollin - Uni of WashingtonUploaded byAnonymous DLEF3Gv
- python_crash_courseUploaded bybb3rn4rd
- SIMD Nested ConditionalsUploaded byBob
- AU2Uploaded bySlavk Uzice
- Php w3 SchoolUploaded byJSEL
- Introduction to Econometrics with RUploaded byHervé Dakpo
- SysadminUploaded bypraveenip
- Chapter 3 - Fundamentals of Programming LanguageUploaded byShahrul Ikhmal
- ch3Uploaded byDesca Tri Paulus
- Synthesizing Latches DoulosUploaded byMiguel Bruno
- ec079Uploaded bygreenday3
- Assignment #1 (1)Uploaded byDarlene Ramirez Peña
- Chapter 13Uploaded byYena Kang
- FP201 3.Prog ControlUploaded byMuhammad Mukhromin
- 7cd7e4162b62e3f4c308bfb303a7f973_march-25-notes-.docxUploaded byюрий локтионов
- MSc_SA&L_L03_ReliabilityNotes_2008_2009[1]Uploaded bymamad66
- 1a. UI STAT S1 week 1 0205 handout.pdfUploaded byChristian Jeremia
- 68380_tocUploaded byRojas Mauromauricio
- Section 8b Peussdistributions 2 Slides Compatibility ModeUploaded byandre_jvc
- QUAMET1 FormulasUploaded byNeil Bascos
- Lect Class 4Uploaded byVikrant Sharma
- Module 1Uploaded byKumarecit
- 10-12-28-04-39-13-850-marisUploaded byJagadeesh Kumar Tentu
- C Language TutorialUploaded byHitesh Rahangdale
- Class 03 - Black-Litterman - For Distribution-5Uploaded byNorine Melodize
- VLSIUploaded byMahesh G Raju
- BETA βUploaded bynsri85
- Normal DistributionUploaded byShakeb Azmi
- ASWchapter6Uploaded byTaimur Zia

- Curiosity RoverUploaded byAbhinav Gupta
- Joint DistributionsUploaded bychacha_420
- Stardust BrochureUploaded byBob Andrepont
- EXPASSVG-IHSTATmacrofreeUploaded bySebastian Antonio Diaz Fernandez
- Chi Dist TableUploaded byjohnt92
- PHILGOV - The Battle of MactanUploaded bysirshanelaong
- Mac ExercisesUploaded bying_ing84
- PHYSICS TOPICAL QUESTIONUploaded byKavitha Balakrishnan
- Assignment Results(2)Uploaded byHai Dang Trinh
- Testing of HypothesisUploaded bysaketrama
- IMG_0016Uploaded bymakhzun
- Scientific Notation ActivitiesUploaded by2018MW
- MatricesAsFunctionsUnderMultiplication.pdfUploaded byMagicfreak216
- polyedrosUploaded byAttila Marechal
- The Vernier and Micrometer Caliper Formal PaperUploaded byFrances Andrea Pelingo
- Topographic Map of PaducahUploaded byHistoricalMaps
- Mixed tenses in context exerciseUploaded byEmma Farquharson
- Light Paper 3Uploaded byYana Azieyana
- Week1_GDTUploaded byfamilyuma
- 051 - Pr 03 - Charge Distributions as Dirac Delta FunctionsUploaded byBradley Nartowt
- Idiots Guide to GraphUploaded byWai Kit Phoon
- Midterm 1 PracticeUploaded byHoang Trung Nguyen
- Tabla G CochranUploaded byJose Alfredo Diaz
- Jacques Vallee Interview by Brent Raynes.pdfUploaded byalphatauri13
- Apollo 13 Mission Operation ReportUploaded byBob Andrepont
- Week 8 - AdmundsenUploaded byernsteins
- Jupiter Planet NotesUploaded byKen Chan
- Exponent and PowerUploaded byBhupesh Kumar
- Labsheet MTE 4Uploaded byTengku Mohamad Amer
- Topographic Map of FuldaUploaded byHistoricalMaps