How to create price weighted index function?
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm looking to calculate the following price weighted function using the average price data AvgPrice2019. It just results in NaN. Can someone help?
I still keep getting NaN. Do you know why?
댓글 수: 1
Jan
2022년 4월 29일
Typing an answer would be easier, if you post the code as text, not as screenshot. Then the readers can copy&paste it to show a modification.
채택된 답변
Jan
2022년 4월 29일
Start with using Matlab methods instead of the loops:
avg = AvgPrice2019;
meanAavg = sum(avg);
pweight = avg / meanAvg;
If this replies NaNs only, a value in avg is infinite:
avg(~isfinite(avg))
What do you see?
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!