% M 函数eg2_4a.mfunction y =eg2_4a(x)n = length(x);for i =1:n if x(i) >2 y(i) =x(i)^3; elseif x(i) >-1 y(i) =8; else y(i) =7-x(i); endend