Borrar filtros
Borrar filtros

To find a value on x axis corresponding to a y value( found by interpolation) in a MATLAB plot

2 visualizaciones (últimos 30 días)
I have a 57*61 array that has values in each row approximately between 40.21 to 94.34 in percentage. Each row is plotted against other vector of 1*61.
The values change unevenly in each row. Now I have to find two values that are close to 50. For first row they are at (1,6) and (1,7), but they change in each row, so how can I get the two values in each row in immediate proximity of 50. I then plan to use interpolation to find the x value (in the 1*61 vector) corresponding to the y value.

Respuesta aceptada

Jan
Jan el 24 de Mzo. de 2018
For each row:
Result = zeros(1, 57);
for iCol = 1:57
Result(iCol) = interp1(Data(iCol, :), y, 50);
end
where y is your 1x61 vector.
But this replies 1 value for each column. Why do you want to find 2 values?
  1 comentario
Avi
Avi el 25 de Mzo. de 2018
@jan thanks for you reply. I need two values as the value corresponding to exact 50 is not available in the y(1*61) vector.
I have to use the two values in another plot of the same y values and corresponding percentage (50 in this case) converted to lengths which give a non linear plot to find the x values. And also I have two x values(x1 &X2) (57*61) corresponding to same y(1*61). Sorry I forgot to mention that earlier.

Iniciar sesión para comentar.

Más respuestas (1)

Avi
Avi el 25 de Mzo. de 2018
After thinking on the solution by @jan I was able to determine the method to be used. % this gives the logical true values for numbers those are less then 50 For i = 1:57 For j = 1:61 if x1(i,j)<= 50 abc(i,j)= x1(i,j); end end end Then I just have to sum the number of true values to find the column number along the row. And I get the coordates of the number less then 50 and +1 to the column number gives the one greater then 50 and then I get corresponding values on the y axis.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by