How to calculate price weighted function?

조회 수: 2 (최근 30일)
de Bord Julien
de Bord Julien 2022년 4월 28일
댓글: de Bord Julien 2022년 4월 29일
I'm trying to calculate the following function in Matlab. This is what I have tried so far but it gives me NaN. Can someone help?

답변 (1개)

Mahmoud Ashraf
Mahmoud Ashraf 2022년 4월 28일
avg=rand(1,505);
sum=0;
for j=1:505
sum=sum+avg(1,j);
end
for m=1:505
pweight(1,m)=avg(1,j)/sum;
end
  댓글 수: 1
de Bord Julien
de Bord Julien 2022년 4월 29일
I'm still having trouble when I try to plug in the price data instead of rand(1,505):
I still keep getting NaN. Do you know why?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Financial Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by