Matlab code functions for Stock price or Asset price simple rate of return and compounded rate of return
Matlab code functions for Stock price or Asset price simple rate of return and compounded rate of return function r = simpleRateReturn(x) r = zeros(size(x)); %start at 2 otherwise loop will go out of bounds for i = 2:length(x) r(i) = (x(i) – x(i-1))/x(i-1); end — function r=compoundedRateReturn(x) r = zeros(size(x)); %start at 2 otherwise …