%RISIVER narise diskretno veriznico
%RISIVER(T1,T2,l,ro,tol,nt,barva)
%T1 in T2 sta krajisci veriznice oblike
%RISIVER narise zvezno veriznico in poisce minimum
%T_min=RISIVER(T!,T2,l,tol,nt,barva)
%T1=[a,A], T2=[b,B], l je dolzina, 
%tol toleranca pri iteraciji,
%nt stevilo tock risanja in barva barva izrisa

function T_min=risiver(T1,T2,l,tol,nt,barva);
  T_min=zeros(1,2);
  z=isciz(T1,T2,l,1,tol); %z0=1
  a=T1(1);A=T1(2);b=T2(1);B=T2(2);
  k1=(B-A)/l;
  k2=atanh(k1);
  u=k2-z;
  v=k2+z;
  C=(b-a)/(2*z);
  D=(a*v-b*u)/(2*z);
  x=linspace(a,b,nt);
  lambda=A-C*cosh((a-D)/C);
  y=lambda+C*cosh((x-D)/C);
  plot(x,y,barva);
  grid on
  T_min=[D,lambda+C];
