I am using below Matlab code to calculate power function i.e. without using built-in function. My requirement is - What improvement/ suggestion make the below function support fractional base and exponential values to calculate power? Thank you
b = [-32:32]; % example input values
e = [-3:3]; % example input values but doesn't support fraction's
power_function(b,e)
p = 1;
if e < 0
e = abs(e);
multiplier = 1/b;
else
multiplier = b;
end
for k = 1:e
p(:) = p * multiplier;
end