# MATLAB: Is it better to use sqrt or ^(1/2)

^MATLABsqrt

In order to have better performance in terms of computational time, is it better to use sqrt or ^(1/2) ?

clc; clear all N = 10:10:100000;t_sqrt = zeros(length(N),1) ;t_pow = t_sqrt ;for i = 1:length(N)    k = rand(N(i),1) ;    t1 = tic ;    k1 = sqrt(k) ;    t_sqrt(i) = toc(t1) ;    %    t2 = tic ;    k2 = k.^0.5 ;    t_pow(i) = toc(t2) ;endfigureplot(t_sqrt,'r') ;hold onplot(t_pow,'b') ;legend('sqrt','power')