You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: hist2d.m
    path of file: ./repos/mcmcstat
    
    the code of the file until where you have to start completion: function [y,xx,yy]=hist2d(x,mxmy,nbin,lam,plots)
%HIST2D 2d smoothed histogram calculations
% [z,xout,yout] = hist2d(xy,[xmin xmax ymin ymax],nbin)

% todo: how to set the default smoothing parameter?
% how to set the default nbin?


    
function [y,xx,yy]=hist2d(x,mxmy,nbin,lam,plots)
%HIST2D 2d smoothed histogram calculations
% [z,xout,yout] = hist2d(xy,[xmin xmax ymin ymax],nbin)

% todo: how to set the default smoothing parameter?
% how to set the default nbin?

% Marko Laine <marko.laine@fmi.fi>
% $Revision: 1.6 $  $Date: 2013/07/12 07:34:03 $

if nargin<2 | isempty(mxmy)
  mxmy = [min(x(:,1)),max(x(:,1)),min(x(:,2)),max(x(:,2))];
end