% Add a node to the model.
%
% [opt, sn] = addNode(opt, name, snFrom, portFrom, snTo, portTo)

function [opt, sn] = addNode(opt, name, snFrom, portFrom, snTo, portTo)
  
  % get coefficient matrix from source
  m = 

  % create new node
  sn = opt.N + 1;
  newNode = struct('name', name, 'sn', sn, ...
                   'snParent', snTo, 'nParent', portTo, ...
                   'snSource', snFrom, 'nSource', portFrom, ...
                   'qx', 0, 'qy', 0, 'm', []);

  % add new node to optical model
  opt.node(sn) = newNode;
  opt.N = sn;

