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: Computation concerning 2-D arrays not compiling
Replies: 5   Last Post: Oct 23, 2012 3:31 AM

Advanced Search

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

Posts: 46
Registered: 12/6/04
Computation concerning 2-D arrays not compiling
Posted: Oct 20, 2012 7:18 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

time_max = 20;
timestep = 0.1;
t = 0:timestep:time_max-timestep;
x = zeros(10,size(t));

for i=1:1:time_max/timestep
for index=1:1:20
Input = I(index);
if (i>(1/timestep))
Input=0;
end
w = x(index,i+1);
signal = 0;
for k=1:1:10
if (k ~= index)
signal = signal + x(k,i);
end
end
x(index,i+1) = -A*x(index,i)+(B-x(index,i))*(w+I)-x(index,i)*signal;
end
end

%plot(t,x(1,:))
%plot(t,x(2,:))
%plot(t,x(3,:))



Hey I'm writing this code and it won't compile correctly and I have no idea why. The basis of this code (in case it helps) is that there are ten columns to x with #rows=time/timestep. The loops go through each column for a row to compute a certain value and then move on to the next row. Also I is a 1-D array of size 10 with constants.

First there is a warning concerning the initialization x = zeros(10,size(t)); -- " Input arguments must be scalar."


Secondly, what I'm really concerned about, is that there is an error concerning the line x(index,i+1) = -A*x(....
which says -- " Undefined function 'plus' for input arguments of type 'cell' "

Anybody have some idea why this is happening? Thanks, in advance.
PS: First post, so not sure if this kind of 'debugging' posts is ok



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.