       function hfi = app_int(x,y,z,s,dc)
        % This function approximates interpolated shading by 
        % interpolating data and using flat shading.  The inputs
        % are the data that was used to generate the original
        % object, a scale factor, and a string that contains the
        % drawing command. The function returns a handle to the
        % new object.
        %
        % Syntax 1:For just Z-Data (e.g., surf(z) => 
        % app_int(z,s,dc)
        % z = zdata, s = scaling factor and dc = drawing command
        % used to create the plot
        %
        % Syntax 2: For x,y,z Data ( e.g., surf(x,y,z) ) => 
        % app_int(x,y,z,s,dc)
        %
        % Example 1: [x,y,z] = peaks;surf(z);shading interp
        % app_int(z,3,'surf')   interpolate by a factor of 3
        %
        % Example 2: [x,y,z ] = peaks;surf(x,y,z); shading interp
        % app_int(x,y,z,3,'surf')interpolate by a factor of 3

        if ( nargin == 3 )
          dc = z;
          z = x;
          s = y;
          [m n] = size(z);
          x = 1:n; y = (1:m)';
          mscal = m*s;
          nscal = n*s;
          xi = linspace(1,n,nscal);
          yi = linspace(1,m,mscal)';
          zi = interp2(x,y,z,xi,yi);
          figure;
          cmd = ['hfi=' dc '(xi,yi,zi);'];
          eval(cmd);
          shading flat;
        elseif ( nargin == 5 )
          [m n] = size(z);
          mscal = m*s;
          nscal = n*s;
          mint = min(min(x));
          maxt = max(max(x));
          xi = linspace(mint,maxt,nscal);  	% modifié de la version originale
          mint = min(min(y));	
          maxt = max(max(y));
          yi = linspace(mint,maxt,mscal)';	% modifié de la version originale
          zi = interp2(x,y,z,xi,yi);		% modifié de la version originale
%          figure;
          cmd = ['hfi=' dc '(xi,yi,zi);'];
          eval(cmd);
          shading flat;
        end
