function y=f1(x,t) %% State variable derivatives for solar car simulation %% suitable for use in lsode() %% x(1) is velocity, x(2) is position %% x'(1) is acceleration, x'(2) is velocity %% See race.m for more info. global pf delv if (length(x) != 2) error("what") end k=floor(x(1)/delv)+1; if (k<1 || k>size(pf,1)) error("out of bounds") end y=[ polyval(pf(k,:),x(1)), x(1) ];