clear;
%[c, T] = meshgrid( 0.005 :0.005:0.995, 0.01: 0.01: 1.99 );
c = -.99:0.005:.99;
T = 0.01:0.005:1.99;
%S = (1 - c)/2 + T .* ( (c+1)/2 .* log( (c+1)/2 ) + ( 1 - c )/2 .* log( (1 - c)/2 ) );
for i = 1: length( c ),
    %temp =( ( c( i ) + 1 )/2 )* log( ( c( i ) + 1 ) / 2 ) + ( ( 1 - c( i ) ) / 2 ) * log( ( 1 - c( i ) ) / 2 );
    temp = ( (1 + c( i ) ) / 2 ) * log( (1 + c( i ) ) / 2  ) + ( ( 1 - c( i ) ) / 2 ) *  log( ( 1 - c( i ) ) / 2 );
    for l = 1: length( T ),
        %S( i , l ) = ( 1 - c( i ) )/2  +  T( l ) *  temp;
        S(l, i ) = ( 1 - c( i ) ) / 2 - ( ( 1 - c( i ) ) / 2 ) ^ 2 + T( l ) * temp / 2 ;
    end;
end;
mesh( c, T, S );
xlabel('c' );
ylabel('T');
zlabel('F');
grid on;