function slview(Int,UU,LL,K,N) % % slview(Int,UU,LL,K,N) % % The program slview enables the user to see the graphs of the % eigenfunctions of a Sturm-Liouville problem. It uses the output % of the function sl. In particular if % [UU,VV,LL] = sl(Int,b1,b2,'p','q','r'), % then UU and LL are two of the necessary arguments of slview. % Another is Int=[a,b], which is the interval on which the % Sturm-Liouville problem is defined. The other two arguments % are integers. The program then displays the graphs of the % eigenfunctions in the file UU in groups % of K at a time, with a total of N groups displayed. % % Defaults are available as follows: % slview(Int,UU,LL) uses K = 2 and N = 10. % slview(Int,UU,LL,K) uses N = 10. % % if (nargin < 3) error('There must be at least three input arguments.') end a=Int(1); b=Int(2); [p,q]=size(UU); x=(a+[0:p-1]*(b-a)/(p-1))'; if (nargin < 4) K=2; end if (nargin < 5) N=10; end N = min(N,q-K+1); if (K == 1) for k=1:N V = UU(:,k)/norm(UU(:,k),inf); VV = V*sign(V(2)); plot([a,b],[0,0],'color',0.8*[1 1 1]),hold on axis([a,b,-1,1]); plot(x,VV); shg, hold off title(['Eigenfuction ',num2str(k),'.']); disp(['Eigenvalue # ',num2str(k),' is ',num2str(LL(k),10),'.']); if (k < N) pause; end end else for k=1:N for j=1:K V=UU(:,k+j-1)/norm(UU(:,k+j-1),inf); VV(:,j) = V*sign(V(2)); end axis([a,b,-1,1]); plot([a,b],[0,0],'color',0.8*[1 1 1]),hold on plot(x,VV), axis tight, shg hold off title(['Eigenfunctions ',num2str(k),' through ',num2str(k+K-1),'.']); disp(['Eigenvalues # ',num2str(k),' through ',num2str(k+K-1),':']); for j=1:K disp(LL(k+j-1)); end if (k < N) pause;end end end axis('normal');