NNLS problem</h2><pre class="codeinput"><span class="keyword">if</span> nargin&lt;5
    x = zeros(size(A,2),size(Y,2));
    <span class="keyword">if</span> nargin&lt;4
        G = A'*A;
    <span class="keyword">elseif</span> size(G,1)~=size(A,2)
        disp(<span class="string">'G has wrong dimensions.'</span>)
        <span class="keyword">return</span>
    <span class="keyword">end</span>
<span class="keyword">elseif</span> (size(x,1)~=size(A,2))||(size(x,2)~=size(Y,2))
    disp(<span class="string">'x 