matlab 中自定义函数 和导入数据的结合不知道怎么写 命令框中不知道如何运行

题目是这样的:ChinaStock.mat consists of the weekly close price of four Chinese companies (i.e. Tencent, JD,

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.

img

运行结果及报错内容
function [r]=LogReturn(p)

r = log(p(2:end)./p(1:end-1));
end

我想不明白如何有效的使用user-defined function 建立方程去算出四个公司的返回收益,我在想如何控制列变量去控制方程,但是写不出来,求指点!上面是我编写的function语句