Hi guys, I am writing a simple code to calculate probability of a two dimension t random number distribution with the Monte-Caro method as you can see. While there is error "Attempted to access x(2); index out of bounds because numel(x)=1." Many thanks for your help!
clear;clc;
n=10000;
x=trnd(6)*1+3;
y=trnd(6)*1+3;
c=0;s=0;
for i=1:n
s=s+1;
if 2<x(i)&&x(i)<4&&y(i)>4||x(i)>4&&y(i)>2
c=c+1;
else
end
end
p=c/s;
Attempted to access x(2); index out of bounds because numel(x)=1.
Error in normal (line 13)
if 2<x(i)&&x(i)<4&&y(i)>4||x(i)>4&&y(i)>2