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: plot.m
    path of file: ./repos/CanlabCore/CanlabCore/External/spider/clust/@one_class_svm
    
    the code of the file until where you have to start completion: function data_square_plot(a,d)
% clf;
%

% Plots a surface plot of an svm which uses !_2_! dimensional inputs.

% Red decision line is drawn.

%

% Usage :  

%           plot(a)

%

% a -- The algorithm already trained

    
function data_square_plot(a,d)
% clf;
%

% Plots a surface plot of an svm which uses !_2_! dimensional inputs.

% Red decision line is drawn.

%

% Usage :  

%           plot(a)

%

% a -- The algorithm already trained

%      The colormap can be changed afterwards.

%

% Example:

%   d=gen(spiral({'n=1','m=50'}));

%   [r s0]=train(svm(kernel('rbf',1)),d)

%   plot(s0);  





% clf


x=d.X;

y=d.Y;

ax1=min(x); ax2=max(x);



c1=find(y==1);

c2=find(y==-1);







granul=100;

minX=floor(ax1(1));

maxX=ceil(ax2(1));

minY=floor(ax1(2));

maxY=ceil(ax2(2));

axis_sz=[minX maxX minY maxY];

minX=minX-2; maxX=maxX+2; minY=minY-2; maxY=maxY+2;

gridx=[]; gridy=[];



mx=zeros(granul*granul,2);

for i=1:granul

 for j=1:granul

   mx((i-1)*granul+j,:)= [minX+(i-1)*(maxX-minX)/granul minY+(j-1)*(maxY-minY)/granul ] ;

   gridx(i)=minX+(i-1)*(maxX-minX)/granul;

   gridy(j)=minY+(j-1)*(maxY-minY)/granul;

end