%konstante
Kt=2.5;Ka=0.15;Km=.1;
omm=300;Ba=2e-3;
di=1;
[t,x,y]=gear('nek9e',0.5,[],[1e-4,.001,.1]);
figure(1),plot(t,y,'k'),title('Odziv pri zacetnem Km'),
xlabel('cas/s'),ylabel('hitrost')
global Km;
%p=fmin('optim9', 0.001, 1);
%Km=p;
Km = 0.0768
[t,x,y]=gear('nek9e', 0.5, [], [1e-4, 0.001, 0.1]);
figure(2),plot(t,y,'k'),title('Odziv optimiziran na Km'),
xlabel('cas/s'),ylabel('hitrost')
function [y0,y1]=optim9(xo)
global Km;
Km=xo;
[t,x,y]=gear('nek9e',0.5,[],[1e-4,.001,.1]);
stac=y(length(y));
pren=max(y)/stac;
e=y-stac*ones(size(y)) - y;
y0=abs(pren - 1);
y1=sum(e.^2);
Optimalno ojacanje je
