fbpx

Matlab code functions for Stock price or Asset price simple rate of return and compounded rate of return

(Last Updated On: November 1, 2011)

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 loop will go out of bounds
for i = 2:length(x)

r(i) = log(x(i)/x(i-1));

end

 

 

 

 

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Subscribe For Latest Updates

Sign up to best of business news, informed analysis and opinions on what matters to you.
Invalid email address
We promise not to spam you. You can unsubscribe at any time.

NOTE!

Check NEW site on stock forex and ETF analysis and automation

Scroll to Top