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: sw_resconv.m
    path of file: ./repos/spinw/swfiles
    
    the code of the file until where you have to start completion: function M = sw_resconv(M,x,dx,func0)
% convolution of a matrix and a Gaussian
% 
% ### Syntax
% 
% `Mout = sw_resconv(M,x,dx,func)`
% 
% ### Description
% 
% `Mout = sw_resconv(M,x,dx,func)` convolutes a 2D matrix with a Gaussian
% along the first dimension of the matrix. The convolution keeps the
% integrated intensity $\sum I\cdot d
    
function shape with header `y = func(x,p)`,
%   where `x` is a column vector, `p` is a row vector of parameters. The
%   meaning of the first 2 elements of the parameter vector are fixed.
%
%   * `p(1)` integral of the function.
%   * `p(2)` center of mass position of the function.
%
%   Optional, default value is `@swfunc.gaussfwhm`.
% 
% ### Output Arguments
% 
% `Mout`
% : Matrix with same dimensions as the input `M`.
% 
% ### See Also
% 
% [sw_res] \| [swfunc.gaussfwhm]
%
% *[FWHM]: Full Width at Half Maximum
%

if nargin == 0
    swhelp sw_resconv
    return
end