%input is a matrix %(of any size, including vector or scalar) % x and a power p %takes each element of x to power p function f=elementwise_powerfun(x,p) f=x.^p;