I have something like this. Where RC.p14 is some function dependent on some parameters.
t=ogj.a:ogj.s:ogj.b;
lk1 = zeros(1,length(t));
f1=RC.lkPrepare(@RC.p14,l1);
for i=1:length(t)
lk1(i)=RC.lk(@RC.p14,l1,t(i),f1);
end
end
function res=lk(p,l,t,f)
res=subs(f, 'z', t)/p(l,t);
end
function res=lkPrepare(p,l)
syms z
res=diff(1-p(l,z));
end
But subs in loop took too much time. And is there a way to prepare function for the loop?