clear all, close all

for h = 0.1:0.2:1.5
    hold on

    r = 2;
    R = 4;

    N = 15;
    x = linspace(0, h, N+1);
    dx = h/N;
    y0 = r + ((R-r)/h)*x(2:end-1);
    [y, fval] = fminsearch(@(x) area(x, dx, N, r, R), y0, optimset('MaxFunEval',1e4));

    plot(x, [r, y, R], 'b-');
    plot(x, [r, y0, R], 'r-');
    plot(0, 0, 'w');
end
hold on
