Interpolation

2 visualizaciones (últimos 30 días)
Ferd
Ferd el 23 de Abr. de 2012
Hello,
I have table values,
Table:
For, X-interval = 360-380 x-units, Y-interval = 2200-2400 y-units
Z-value = 900 z-units
Calculation: X-calc Value = 371x-units, Y-calc Value = 2375 y-units
Z-calc Value = ?
I looked up interp2, interp3 but since the first row and column are basically ranges or intervals and are basically just references for Z-table value, it doesn't give an answer. It says the z value must be a 2-by-2 matrix where in fact my z table value is just 1-by-1 value.
  1 comentario
Jan
Jan el 23 de Abr. de 2012
It is easier to answer, if you post a working set of inputs.
What are "y-units"?

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de Abr. de 2012
To clarify: if the combination holds of x in 360 to 380, and y in 2200 to 2400, then z should be the constant value 900? If so, use logical indexing.
Table = [360 380 2200 2400 900; 325 333 2817 2895 888]; %e.g.
z = NaN(size(X_calc));
for K = 1 : size(Table,1)
idx = X_calc >= Table(K,1) & X_calc <= Table(K,2) & ...
Y_calc >= Table(K,3) & Y_calc <= Table(K,4);
z(idx) = Table(K,5);
end
  1 comentario
Ferd
Ferd el 25 de Abr. de 2012
Hey! Kewl Thanks! It works...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by