Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: index out of bounds error
Replies: 7   Last Post: Mar 8, 2013 1:13 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
nur

Posts: 16
Registered: 1/3/08
index out of bounds error
Posted: Feb 28, 2013 11:34 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi,
I'm doing a research on crowd behavior analysis.I've a problem with the coding below;

clear; clc; close all;
mx=45; my=45;
X=10;
d=zeros(mx,my); dx=zeros(mx,my); dy=zeros(mx,my);

Lx=10;Ly=10;
hx=Lx/(mx-1); hy=Ly/(my-1);
x=0:Lx/(mx-1):Lx; y=0:Ly/(my-1):Ly;

N_Obst=2; xx=[X]; yy=[X]; rr=[X];

d(1:mx, 1:my)=Lx+Ly;
for i=1:1:mx
x(i)=(i-1)*hx;
for j=1:1:my
y(j)=(j-1)*hy;

for n=1:1:N_Obst
dtemp=sqrt((xx(n)-x(i))^2+(yy(n)-y(j))^2)-rr(n);
% dtemp=sqrt((x(n)-x(i))^2+(y(n)-y(j))^2);
if dtemp<d(i,j); d(i,j)=dtemp; end
end

Error => Attempted to access xx(2); index out of bounds because numel(xx)=1.

Anyone can help me solve this problem?
Thanks in advance.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.