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: nnlsim.m
    path of file: ./repos/MataveID/old/source
    
    the code of the file until where you have to start completion: % nnlsim is a function to simulate nonlinear state space models.
% Input: nlsys, u, t, x0(optional)
% Example 1: [y,t,X] = nnlsim(nlsys, u, t, x0);
% Example 1: [y,t,X] = nnlsim(nlsys, u, t);
% Author: Daniel MÃ¥rtensson, June 2018

function [y,t,X] = nnlsim (varargin)
  MAXvector = 1000; % Maximum dimension of state vector and in
    
function to simulate nonlinear state space models.
% Input: nlsys, u, t, x0(optional)
% Example 1: [y,t,X] = nnlsim(nlsys, u, t, x0);
% Example 1: [y,t,X] = nnlsim(nlsys, u, t);
% Author: Daniel MÃ¥rtensson, June 2018

function [y,t,X] = nnlsim (varargin)
  MAXvector = 1000; % Maximum dimension of state vector and input vector
  
  % Check if there is some input arguments or it's not a model
  if(isempty(varargin{1}))
    error ('Missing model')
  end