% showcspsolns(X,epsilon,lambda) makes a simultaneous plot of
% all the solutions functions specified in X. Here epsilon is
% the vector of solution degrees, and lambda is a vector of
% eigenvalues to use in the plot. The showlambda argument is
% optional and indicates whether or not to show the eigenvalues
% in the plot (default is NOT to show the eigenvalues). The real
% work is done in showcspsoln, which makes the plot for one
% solution. See the showcspsoln documentation for more plot
% details. Note that this routine first clears the current figure.

function showcspsolns(X,epsilon,lambda,showlambda)

[m,p] = size(X);
if (rem(m,epsilon(p)+1) ~= 0)
  error('number of rows in X must be divisible by epsilon(p)+1');
end
n = m/(epsilon(p)+1);
if (nargin < 4) showlambda = 0; end

clf;
for j=1:p    
  showcspsoln(X(1:(epsilon(j)+1)*n,j),epsilon(j),lambda,showlambda);
  hold on;
end
