mon
Posts:
46
Registered:
12/6/04
|
|
Re: Computation concerning 2-D arrays not compiling
Posted:
Oct 23, 2012 12:10 AM
|
|
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
|
|