Documentation of findX


Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)


Function Synopsis

X0=findX(F,F0,X);

Help text


 function X0=findX(F,F0,X);

 Finds the value(s) of X for which F(X) assumes the value F0
 (F and X are vectors, F0 is a scalar)

 The vector X0 is sorted


Cross-Reference Information

This function calls

Listing of function findX

function X0=findX(F,F0,X);
  if ~isvector(F) | ~isvector(X) | length(F)~=length(X)
      error('F and X must be vectors of the same length')
  end
  if ~isscalar(F0)
      error('F0 must be a scalar')
  end
  %if max(isnan(F)), error('F contains NaN'), end

  F1=F(find(~isnan(F))); X1=X(find(~isnan(F)));

  tmp=sign(F1-F0);
  ind=find(diff(tmp));
  Y=NaN*ind;
  for i=1:length(ind)
    Y(i)=interp1(F1(ind(i):ind(i)+1),  X1(ind(i):ind(i)+1) , F0);
  end
  X0=unique(Y);