Code covered by the BSD License  

Highlights from
Single-variable linear level finding ("inverse" INTERP1): findX

4.0

4.0 | 2 ratings Rate this file 7 Downloads (last 30 days) File Size: 1.73 KB File ID: #23860

Single-variable linear level finding ("inverse" INTERP1): findX

by Antoni J. Canós

 

22 Apr 2009 (Updated 05 May 2009)

Estimates the XI values at which the dependent variables Y reach a specified level YI.

| Watch this File

File Information
Description

XI = findX(X,Y,YI) estimates the XI values at which the dependent
variables Y reach or cross a specified target level YI (scalar value). If there are multiple solutions, findX finds all of them. It may be seen as the "inverse" operation of the MATLAB's function
INTERP1, under 'linear' method.

X is a vector containing a sequence of monotone increasing values of the independent variable. Y is a vector containing the discrete values of the dependent variable (underlying function).

[XI,IDEXACT] = findX(X,Y,YI) returns in IDEXACT the indices where the original values of Y exactly reach the target level YI, i.e. Y(IDEXACT)=YI, so interpolation was not needed.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
22 Apr 2009 Darren Rowland

The first few lines of this file are

% findX.m
%
% Antoni J. Canós, ITACA Institute - Technical University of Valencia
%
% Based on find_cross.m by
% Phillip M. Feldman, Northrop Grumman Space Technology
% Version 2.0 Nov. 9, 2005
% in http://www.mathworks.com/matlabcentral/fileexchange/8975
% (File ID: #8975)

Features a large number of other poor comments such as
% idx should be a very small array, so we can afford to use a loop

when no loop is present.

05 May 2009 Darren Rowland

This file is now much improved, featuring a H1 line and useful descriptions. If I could suggest some areas for minor improvement:
- error checking to ensure inputs are, for instance, not complex,
- if only two inputs are given i.e. no YI, then YI defaults to zero.

12 May 2009 Phillip M. Feldman

Your code is amazingly compact, and I like it better than mine.

I was actually trying to do something slightly different. For discrete-valued sequences, I'd like to be able to exclude cases where the sequence reaches the target level but does not actually cross it. However, this feature of my code appears to not be functioning correctly.

Please login to add a comment or rating.
Updates
05 May 2009

Important bug fixed. New features added. Help rewritten.

Tag Activity for this File
Tag Applied By Date/Time
interpolation Antoni J. Canós 22 Apr 2009 09:11:34
data exploration Antoni J. Canós 22 Apr 2009 09:11:34
mathematics Antoni J. Canós 22 Apr 2009 09:11:34
approximation Antoni J. Canós 22 Apr 2009 09:11:35
inverse interp1 Antoni J. Canós 22 Apr 2009 09:11:35
find zeros Antoni J. Canós 22 Apr 2009 09:11:35
level crossing Antoni J. Canós 22 Apr 2009 09:11:35
find level Antoni J. Canós 05 May 2009 13:30:35
find cross Antoni J. Canós 05 May 2009 13:30:52

Contact us at files@mathworks.com