CS-UY 1114 Lecture Notes - Lecture 9: Probability Distribution, Random Variable
Document Summary
Continuous random variable: a variable that can take on any value of an infinite number of possible values within 1+ ranges randomly (with certain probability density) Discrete random variable: variable that takes discrete values at random. Simplest and most useful continuous random variable is one that is distributed uniformly and randomly. Values found with rand function are distributed uniformly within [0,1] probability density of variable. Random numbers are not truly random rng(0); %same as writing rng( default") rand(m,n) %gives a m x n matrix of random numbers rand(m) %gives a m x m matrix of random numbers. Rand=a+(b-a)*rand(m,n) % where the interval you want is [a,b] A method that uses a large # of randomly created sample points from the relevant variables. %% compute pi by simulation clear; clc; npts = 7e6; Dist = sqrt (xcoord . ^ 2 + ycoord . ^2); Isinside = dist < 1; numberinside=sum(isinside); %can also use nnz.