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
Re: Computation concerning 2-D arrays not compiling
Posted: Oct 23, 2012 12:10 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hey thanks for your reply. I omitted information that i thought wouldn't be too relevent so i guess that was a bad idea.
1. Input never being used was a silly mistake. I forgot to chance "I" down the line to "Input" In short: I = Input, Input =I.

2. A and B are scalar ints, not matrices.

3. size t yields: 1 200
and length yields 200. So I'm assuming this indicates a standard 1-D array of length 200? (which is what it is supposed to be)

Here is the unabridged code in case I forgot anything else:






function [] = recurrent_competitive_field()

I = {0.2, 0.7, 0.9, 0.6, 0.3, 0.5, 0.4, 0.8, 0.5, 0.1};

A = 1;
B = 3;
%F = 0.25;
time_max = 20;
timestep = 0.1;
t = 0:timestep:time_max-timestep;

x = zeros(size(t));
x = zeros(10,size(t));
cindex = 0;
for cindex=1:1:10
for j=1:1:(time_max/timestep)
x(cindex,j) = j/10;
end
end


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+Input)-x(index,i)*signal;
end
end




plot(t,x(1,:))
end



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.