Partition function in Matlab - is there something missing in my code?
이전 댓글 표시
Can anyone see if there is something wrong in my matlab code? My objective is to replicate this formula: http://i.stack.imgur.com/JANLf.jpg q can take value 1,2,3 and 5. I constructed my vector Xt where each element are a cumulative sum of log(1+return) at each time (t) - for stock returns - first element is normalized to log(1).
Then to compute each element Sq(T,delta t) for the four values of q this is my matlab code:
for j=1:length(dt);
E=Xt(1:dt(j):end);
EE=diff(E(2:end));
EEE=diff(E(1:end-1));
Sqone(j)=sum(abs(EE-EEE).^1);
Sqtwo(j)=sum(abs(EE-EEE).^2);
Sqthree(j)=sum(abs(EE-EEE).^3);
Sqfive(j)=sum(abs(EE-EEE).^5); end;
Is there something wrong in the code above? I am asking this because I know there is something wrong since I am not getting the expected results. I am convinced that it is due to my code posted above.
the vector dt is a vector that goes from 1 to high number - depending on the size of Xt. But my vector dt is not the problem.
Thank you for all your help!
채택된 답변
추가 답변 (2개)
Charles Martineau
2012년 6월 5일
0 개 추천
댓글 수: 4
Andrei Bobrov
2012년 6월 5일
No, this is a complete solution. 'Sq' - handle function
Charles Martineau
2012년 6월 5일
Andrei Bobrov
2012년 6월 5일
What is it 'dt' and 'Xt'. Please give simple numeric example.
Charles Martineau
2012년 6월 5일
Charles Martineau
2012년 6월 5일
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!