Help with interpolation function

3 views (last 30 days)
Felix
Felix on 1 Apr 2014
Answered: the cyclist on 1 Apr 2014
I have set a monotonic function as an array as the following, with x values in the first column and y in the second;
CDF_array =
-4.0000 0
-3.0000 0.1000
-1.0000 0.4000
1.0000 0.6000
3.0000 0.9000
4.0000 1.0000
How do I interpolate to find the x-values at y=0.05, y=0.15 and y=0.63?

Answers (2)

Star Strider
Star Strider on 1 Apr 2014
With:
CDF = [ -4.0000 0
-3.0000 0.1000
-1.0000 0.4000
1.0000 0.6000
3.0000 0.9000
4.0000 1.0000];
this statement:
xi = interp1(CDF(:,2), CDF(:,1), [0.05; 0.15; 0.63])
produces:
xi =
-3.5000e+000
-2.6667e+000
1.2000e+000

the cyclist
the cyclist on 1 Apr 2014
CDF_array = ...
[-4 0.0;
-3 0.1;
-1 0.4;
1 0.6;
3 0.9;
4 1.0];
y_interp = [0.05 0.15 0.63];
x_interp = interp1(CDF_array(:,2),CDF_array(:,1),y_interp)

Categories

Find more on Interpolation in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!