home *** CD-ROM | disk | FTP | other *** search
- % function [pk,indepv,vindex] = pkvnorm(matin,p)
- %
- % Find peak value of the norm of a VARYING matrix, also
- % returns the value of the INDEPENDENT VARIABLE at the peak,
- % along with the index of the INDEPENDENT VARIABLE. The second
- % input argument determines the particular norm, using the same
- % convention as MATLAB's NORM command.
- %
- % See also: NORM, VNORM, and VSVD.
-
- function [pk,iv,vindex] = pkvnorm(matin,p)
- if nargin == 0
- disp(['usage: [pk,iv,vindex] = pkvnorm(matin,p)']);
- return
- end
- [mtype,mrows,mcols,mnum] = minfo(matin);
- if nargin == 1
- p = 2;
- end
- if mtype == 'cons'
- pk = norm(matin,p);
- vindex = [];
- iv = [];
- elseif mtype == 'vary'
- pk = -inf;
- npts = mnum;
- out = zeros(npts+1,2);
- ff = (npts+1)*mrows;
- pt = 1:mrows:ff;
- ptm1 = pt(2:npts+1)-1;
- for i=1:npts
- val = norm(matin(pt(i):ptm1(i),1:mcols),p);
- if val > pk
- pk = val;
- vindex = i;
- iv = matin(i,mcols+1);
- end
- end
- elseif mtype == 'syst'
- error('PKVNORM is not defined for SYSTEM matrices')
- return
- else
- pk = [];
- vindex = [];
- iv = [];
- end
- %
- % Copyright MUSYN INC 1991, All Rights Reserved
-