Hello,
I have the Brownian motion model and I added In the plot a circle with radus R and center (X,Y). However I have two for loops for x and y to calcualte the model and I want to delete some points if they staisfies this condition:
(x(i)-X)^2 +(y(i)-Y)^2<r^2
When I run the code always gave this massage (Index in position 1 exceeds array bounds (must not exceed 1).) Sometimes is change the number such as ( ndex in position 20 exceeds array bounds (must not exceed 29).)
How I let inside the circle empty.
That what I wrote
please anyone help me for my problem with explain how I can solve this problems if I have simoilar in the future.
T=100;Np=10000;DX=20;%Circle --------------------
A=10;B=10;R=30; th=0:pi/100:2*pi; X=R*cos(th)+A; Y=R*sin(th)+B; %Models
for j=1:m for i=1:T x(i+1,j)=x(i,j)+DX*randn(); y(i+1,j)=y(i,j)+DX*randn(); % Condition--------
COND= (x(i+1,j)-X).^2+(y(i+1,j)-Y).^2; CONDD=int16(trap); if trap <r^2 x(i+1,j)=[]; y(i+1,j)=[]; end endend
Best Answer