function [ val ] = get_max_val( X, Y, x1, x2 ) %GET_MAX_VAL Summary of this function goes here % Detailed explanation goes here len = size(X); val = -100000000; for k = 1:1:len-1 if (x_var >= X(k)) && (x_var < X(k+1)) value = Y(k); end end end