Filter löschen
Filter löschen

Interpolation

7 Ansichten (letzte 30 Tage)
Ferd
Ferd am 23 Apr. 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 Kommentar
Jan
Jan am 23 Apr. 2012
It is easier to answer, if you post a working set of inputs.
What are "y-units"?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 23 Apr. 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 Kommentar
Ferd
Ferd am 25 Apr. 2012
Hey! Kewl Thanks! It works...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by