How to calculate price weighted function?

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?

Respuestas (1)

Mahmoud Ashraf
Mahmoud Ashraf el 28 de Abr. de 2022
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 comentario

de Bord Julien
de Bord Julien el 29 de Abr. de 2022
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?

Iniciar sesión para comentar.

Categorías

Más información sobre Financial Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Abr. de 2022

Comentada:

el 29 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by