shawpnik
shawpnik

Reputation: 111

Simulating result by Monte Carlo Simulation

I have three variables, lets say a, b and c, i have generated 10,000 random numbers of those variables by normal distribution. Now i want to run monte carlo simulation to get the result in 1000 times.
My model is, Y=0.5*a+0.4*b+0.6*c.
Can anyone please help with matlab code?
Thanks in advance

Upvotes: 0

Views: 1922

Answers (1)

Jacob
Jacob

Reputation: 34601

v = randn(1000,3);
y = 0.5*v(:,1)+0.4*v(:,2)+0.6*v(:,3);

where the columns of v are a,b,c and y is the result.

Edit: Given a 10000x3 matrix v, compute y for 1000 samples randomly selected from v.

ind = randperm(10000);
y = 0.5*v(ind(1:1000),1) + 0.4*v(ind(1:1000),2) + 0.6*v(ind(1:1000),3);

I think the random selection of your random data just complicates things. If v is randomly generated, then any set of 1000 samples should be fine.

Upvotes: 4

Related Questions