Sign in

username:

password:



Not a member?

Search Online Books



Search tips

Free Online Books



Chapters

Chapter Contents:

Search Spectral Audio Signal Processing

  

Book Index | Global Index


Would you like to be notified by email when Julius Orion Smith III publishes a new entry into his blog?

  

Matlab listing: maxr.m

function [xi,yi,curvatures] = maxr(a) 
%MAXR   Find interpolated maximizer(s) and max value(s) 
%       for (each column of) a.
%
%               [xi,yi,curvatures] = maxr(a) 
%
%       Calls max() followed by qint() for quadratic interpolation.
%  
   [m,n] = size(a); 
   if m==1, a=a'; t=m; m=n; n=t; end; 
   [y,x] = max(a); 
   xi=x;    % vector of maximizer locations, one per col of a
   yi=y;    % vector of maximum values, one per column of a
   if nargout>2, curvatures = zeros(1,n); end
   for j=1:n,   % loop over columns
     if x(j)>1, % only support interior maxima
       if x(j)<m, 
         [xdelta,yij,cj] = qint(a(x(j)-1,j),y(j),a(x(j)+1,j)); 
         xi(j) = x(j) + xdelta;
         if nargout>2, curvatures(j) = cj; end
         if (nargout>1), yi(j) = yij; end
       end; 
     end; 
   end;


Order a Hardcopy of Spectral Audio Signal Processing

Previous: Matlab listing: findpeaks.m
Next: Matlab listing: qint.m

written by Julius Orion Smith III
Julius Smith's background is in electrical engineering (BS Rice 1975, PhD Stanford 1983). He is presently Professor of Music and Associate Professor (by courtesy) of Electrical Engineering at Stanford's Center for Computer Research in Music and Acoustics (CCRMA), teaching courses and pursuing research related to signal processing applied to music and audio systems. See http://ccrma.stanford.edu/~jos/ for details.


Comments


No comments yet for this page


Add a Comment
You need to login before you can post a comment (best way to prevent spam). ( Not a member? )