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
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
Jan 2022년 4월 29일

0 개 추천

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개)

카테고리

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

질문:

2022년 4월 29일

답변:

Jan
2022년 4월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by