% Part A 

z = (x(1:end-1).^2 + y(1:end-1)) ./ (x(2:end).^2 + y(2:end))

% Part B 

% Possible answer 1 
v = w; 
isBiggerThanU = (w >= U);
v(isBiggerThanU) = M;
isLessThanU = (w <= L);
v(isLessThanU) = 0;

% Possible answer 2 
v_alt = (w <= L) * 0 + ((w > L) & (w < U)) .* w + (w >= U) * M 

