Hi, all! I have a array of monthly log returns from 1962 to 2016, I wish to extract the monthly values, every 12th value.

1 次查看(过去 30 天)
Can andybody assist with this issue? How do I extract every 12th value?
Thanks!

采纳的回答

KL
KL 2017-10-13
编辑:KL 2017-10-13
data = 1:144; %sample data
data_mean = arrayfun(@(a,b) mean(data(a:b)),1:12:numel(data),12:12:numel(data))
  7 个评论
Ola Sveen
Ola Sveen 2017-10-16
KL, i´m sorry for the late reply. Many thanks for your assistance. The task have developed some, and we want to sum every 12th value like you prepose, du you know how this is done?

请先登录,再进行评论。

更多回答(1 个)

Ola Sveen
Ola Sveen 2017-10-13
编辑:Ola Sveen 2017-10-13
Thx KL!
Now I would like to extract annual log returns from a dataset containing prices and dates. Do you know how to solve this? I have calculated the monthly log returns, how do I calculate the annual. I guess I need some sort of loop function, taken in consideration the formula for log return.
many thanks

类别

Help CenterFile Exchange 中查找有关 Language Fundamentals 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by