I have a function func() definition which contains a for() cycle.
Can I then pass func() to lsode() to be resolved as an ODE?
Update: Example of the code.
int = [0; 0];
slp = [0; 1];
x = [1:10];
r = zeros(1,10);
for id = 1 : 2;
r = r + int(id) + slp(id)*x;
end
plot(x,r);
function ydot = fnc(y, t, int, slp)
ydot = zeros(1,10);
for jd = 1 : 2;
ydot = ydot + int(jd) + slp(jd)*t;
end
end
p = lsode(@(y,t) fnc(y,t,int,slp), 1, x);
error: lsode: inconsistent sizes for state and derivative vectors error: called from: error: /path$/test_for_function.m at line 15, column 3