%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                     %%
%%  Plot the solution of the improperly posed Laplace  %%
%%    problem with a triangular boundary condition     %%
%%                                                     %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% compact printing
format compact

% set time to plot ONLY IF IT IS NOT DEFINED YET.
if exist('y') ~= 1
  y=0.
end

% set maximum number of terms to sum if undefined
if exist('n_max') ~= 1
  n_max=3
end

% number of plot points
imax=100;

% plot point x-values
x_vals=[0:imax]/imax*pi;

% perform the sum 
u_vals=badlap_sum(x_vals,y,n_max);

% plot it
plot(x_vals,u_vals,'-')
title(['y = ' , num2str(y) , '      n_{max} = ' , num2str(n_max)], 'fontsize', 14)

% To print, try say,
%print('badlap.gif', '-dgif')
% If that complains about fonts, try
%print('badlap.ps', '-deps')
% and then convert that to gif using say ps2gif
