Baidu, Alibaba) over a year (Apr. 2, 2021 - Apr. 2, 2022). Please write a user-defined function
LogReturn (P) that computes the log return by:
rt = ln(Pt+1/Pt),
where rt
is the return of week t, Pt+1 and Pt are close price of week t + 1 and t, respectively.
r = log(p(2:end)./p(1:end-1));
end