clc, clear all;
y0=1;
U0=[y0 0]';
[t, U]=ode45('dUdx', [0 1],U0);
uold=U(end,1);
plot(t,U(:,1))
hold on
pause
y1=0.5;
U0=[y1 0]';
[t, U]=ode45('dUdx', [0 1],U0);
plot(t,U(:,1))
pause
while  abs(U(end,1)-1)>1e-4
    u0=uold;
    u1=U(end,1);
    y2=y1-(y1-y0)/(u1-u0)*(u1-1)
    uold=U(end,1);
    y0=y1;
    y1=y2;
    U0=[y1 0]';
    [t, U]=ode45('dUdx', [0 1],U0);
    plot(t,U(:,1))
    hold on
    pause
end
 