How to calculate the return rates of the assets?

2 ビュー (過去 30 日間)
Peian MAO
Peian MAO 2021 年 10 月 3 日
コメント済み: Peian MAO 2021 年 10 月 10 日
Excuse-me, I have three questions while dealing with a financial evaluation project using Matlab.
Given the following data, the annual time series of Total Return for each asset:
Year StocksA StocksB StocksC
2003 20.2558 262.933 101.00
2004 25.6862 268.731 106.33
2005 23.4299 284.092 108.33
(There are 43 rows)
Question 1. I want to know how to generate the table of return rates for the three assets (A B and C)?
Question 2. How to definite an objective function as a Handle?
Question 3. For the stocks B, how to extract the information about the years when its value is larger than 270?
Thank you and best regards!

回答 (1 件)

Shravan Kumar Vankaramoni
Shravan Kumar Vankaramoni 2021 年 10 月 8 日
I assume that, you have data in a file and want to import to a MATLAB table. You can use "readtable" function as below
T = readtable(filename);
To filter out the table based on a condition, you can do the following:
T = (T.stocksB > 270, :)
Refer the below links to define objective funciton as a handle
  1 件のコメント
Peian MAO
Peian MAO 2021 年 10 月 10 日
Hello. That's helpful. Thank you a lot.



Find more on Financial Toolbox in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by