Global Index (short | long) | Local contents | Local Index (short | long)
X0=findX(F,F0,X);
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
This function calls | This function is called by |
---|---|
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);