ChinaStock.mat consists of the weekly close price of four Chinese companies (i.e. Tencent, JD,

답변 (1개)

BhaTTa
BhaTTa 2025년 3월 19일

0 개 추천

Hey @Martin Njagi, To calculate the log returns from stock prices, you can follow these steps. Log returns are often preferred in financial analysis because they are time-additive and can be more stable than simple returns.Steps to Calculate Log Returns
  1. Load the Data: First, load your data, which consists of the weekly closing prices of the stocks.
  2. Calculate Log Returns: Use the formula for log returns:
Log Return = log(P_t / P_(t-1))
where ( P_t ) is the price at time ( t ) and ( P_{t-1} ) is the price at the previous time period.
3. Store the Results: Store the log returns in a new matrix or table for further analysis.

카테고리

도움말 센터File Exchange에서 Language Fundamentals에 대해 자세히 알아보기

제품

릴리스

R2016a

질문:

2022년 4월 15일

답변:

2025년 3월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by