function [ret, points] = analyzeProfile(c)

    nadvzork = 5.0;

global show;

    points = zeros(3,1);

%analysis
    %figure
    %plot(c);
    Y = interp(c,nadvzork);
    
    %figure
    %plot(Y)
    
    %find min max center
    [mmax, imax] = max(Y);
    [mmin, imin] = min(Y);
   
    grad = (mmax - mmin);
    
    min20 = mmin + grad*0.1;
    max20 = mmin + grad*0.8;
    half = mmin + grad*0.5;
    
    inInterval = 0;
    start = 0;
    z = [];
    for (j = 1:size(Y,1))
       if (Y(j,1) > min20)
           if (start == 0) start = j; end
           inInterval = 1;
       end
       if (Y(j,1) >= max20)
           inInterval = 0;
           break;
       end
       if inInterval == 1
            z = [z, Y(j,1)];
       end   
    end
    
    if (show == 1)
        if (length(z) > 1)
        figure(9)
        plot(z);
        end
    end
    
    %derivete
    if (size(z,2) < 3)
        ret = 0;
        return;
    end
    dz = (z(1,2:end) - z(1,1:end-1)) + 0.5;
    
    dz = sign(dz);
    
    if (show == 1)
        figure (10)
        plot(dz);
    end
  
    onko = 1;
    y = medfilt1(dz,onko);
    y = y(onko:end);
    
    if (length(y) < 2)
        ret = 0;
        return;
    end

    
    if (show == 1)
        figure (11)
        plot(y);
    end
    
    
    
    
    zer = length(find(y == -1));
    nzer = length(find(y == 1));
 
    crosPos = 0
    crosPos1 = 0
    
    cross = 0;
    for (i = 1:length(y) - 3)
        if (y(i) == 1 && y(i+1) == -1  && y(i+2) == -1  && y(i+3) == -1)
            cross = cross + 1;
        end
    end

    
   for (i = 1:length(y) - 3)
        if (y(i) == -1 && y(i+1) == 1  && y(i+2) == 1  && y(i+3) == 1)
            if (crosPos == 0) crosPos = i;end
        end
    end
    for (i = 3:length(y) - 3)
        if (y(i) == 1 && y(i+1) == -1  && y(i+2) == -1  && y(i+3) == -1)
            if (crosPos1 == 0) crosPos1 = i;end
        end
    end
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%% point 2
    
    points (1,1) = round((start + 2)/nadvzork);
    for (i = 1:length(y) - 3)
        if (y(i) == -1 && y(i+1) == 1  && y(i+2) == 1  && y(i+3) == 1)
            points(2,1) = round((i + 10 + start)/nadvzork);
            break;
        end
    end
    points (3,1) = round((start+length(y))/nadvzork);
    
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
    
    ret = 1;
    if (crosPos > length(y)* 3 / 4)
        ret = 0;
    end
    if (crosPos1 < length(y)* 1 / 6)
        ret = 0;
    end
    if (cross < 1)
        ret = 0;
    end
    if (cross > 2)
        ret = 0;
    end
%    if (nzer/double(zer) > 0.4 )
        %ret = 0;
 %   end
    
    if (show == 1)
        cross
        ret
        pause
    end
end
        