필터 지우기
필터 지우기

Plot return HFD data

조회 수: 2 (최근 30일)
Harsh Rob
Harsh Rob 2019년 8월 6일
댓글: Ajay Pattassery 2019년 8월 9일
I want to plot the returns data in matlab, which is a matrix of about 18 million rows and three colums. I first calculate the return matrix which is 18million*1 matrix. Removing the first value(NaN) as it will cause an error in the plot. When I plot this, the graph is really absurd. It gives me two straight lines. I checked the data and it does range from xx to xxx. Also, when I try labelling it, it thows me an error that 'Index exceeds number of array elements'.
Can someone help me with this please?
I am using the below code -
%Calculate the returns
for i = 2:length(medianP)
returnvalues(1) = NaN;
returnvalues(i) = log(medianP(i)) - log(medianP(i-1));
end
filteredreturns = returnvalues(2:length(returnvalues))
plot(filteredreturns);
A= min(filteredreturns);
B = max(filteredreturns);
n= 17575621;
x= linspace(A,B,n);
y= returnvalues;
xlabel('Time')
ylabel('Returns')
title('Returns plot')
  댓글 수: 1
Ajay Pattassery
Ajay Pattassery 2019년 8월 9일
You will not receive any error in MATLAB if the data you are plotting contains NaN values. The plot simply ignores those values and display the rest.
Please attach the section of code where you are labeling and the 'Index exceeds the number of array elements' error is thrown.
Please share the medianP array to investigate the possible error while plotting.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by