Implementation of getting saddle points of a matrix

Hello everybody ..My homework assignment was :

Write a function called saddle that finds saddle points in the input matrix M. For the purposes of this problem, a saddle point is defined as an element whose value is greater than or equal to every element in its row, and less than or equal to every element in its column. Note that there may be more than one saddle point in M. Return a matrix called indices that has exactly two columns. Each row of indices corresponds to one saddle point with the first element of the row containing the row index of the saddle point and the second element containing the column index. If there is no saddle point in M, then indices is the empty array.

So my code was :

function ind=saddle(matrix)  size_=size(matrix); a=[]; for ii=1:size_(1)      for jj=1:size_(2)         if (matrix(ii,jj)==max(matrix(ii,:))) && (matrix(ii,jj)==min(matrix(:,jj)))             a=[a;[ii ,jj]];         end     end end ind=a; 

Saddle point integration. Null second derivative

I need to calculate an integral by the saddle point method.

$ I=\int_{-\infty}^\infty dt\, f(t)\, e^{i S(t)}$ .

I can find analytically the point $ t_s$ for which $ \frac{\partial S(t_s)}{\partial t}=0$ .

Nevertheless $ \frac{\partial^2 S(t_s)}{\partial t^2}=0$ , as well. This is a problem because the method states that I should have $ \frac{\partial^2 S(t_s)}{\partial t^2}\neq0$ to use the method. If I think of the saddle point method as a simple Taylor expansion of the argument of the exponential to second order, I feel tempted to write the saddle point solution as

$ I^{sp}\approx f(t_s)e^{i S(t_s)}$ ,

instead of

$ I^{sp}\approx \frac{1}{\sqrt{\partial^2 S(t_s)/\partial t^2}} f(t_s)e^{i S(t_s)}$

i.e., just evaluate the phase at $ t_s$ but do not use the second derivative with respect to $ t’$ in the denominator. Is it correct? Or I should go to order $ >2$ when the second derivative is zero?