%BINOMIAL RANDOM VARIABLE
%this is a script for simulating 'm' outcomes of a
'inomial random variable, and comparing the outcome
%of tha experiment with the theoretical PDF.
m=1000; ample size
n=10; 0umber of bernoulli trials
p=0.8; %probsability of suc
imulate m random walks until time t
t=100;
p=0.5;
m=10000;
X=rand(t+1,m);%create a matrix of t rows and m columns
%of uniform(0,1) random outcomes
S=zeros(t+1,m); %create a matrix of t+1 rows and m columns
%with zeros. Then construct the sample path of th
imulate m random walks until time t
t=100;
p=0.5;
m=4;
X=rand(t+1,m);%create a matrix of t rows and m columns
%of uniform(0,1) random outcomes
S=zeros(t+1,m); %create a matrix of t+1 rows and m columns
%with zeros. Then construct the sample path of the ra
0efine a row vector
a=[2,3,-2,4,-2,0]
0efine a column vector
c=[5;2;-4;-1;0;4]
%calculate the inner (dot) product of a and c
b=dot(a,c)
%create a matrix 3x3 matrix
A=[1,2,5; 3,7,-1; 0,3,pi]
%create a 5x4 matrix of zeros
B=zeros(5,4)
%manullay change an en
t=50; % number of periods to simulate
X=zeros(t,1); torage for simulated states
U1=rand(); imulate the first state
if U1<=0.3
X(1,1)=0;
else
X(1,1)=1;
end
for i=2:t
if X(i-1,1)=0 0eed to indicate specifically like matrix
threshold = 0.3;
else
thresh