3

I have two time series of share prices, Price1 and Price2. Tday is the time series of the dates which match for both prices. Now I am trying to match the prices of each to the newly established tday (matching dates time series). I am following instructions of building indexes. I then proceed to match them by creating the new cl1 set which is basically price1 matching the indexed dates as shown below. My problem is that on my old Matlab this used to work fine. Now the cl1 comes out to be a very volatile time series which resembles what it should be but is way to volatile with swings of 20-40% from one data point to the next. I am using Matlab 7.12 R2011a now. Can anybody help me correcting this volatility in cl1 and cl2?

[tday, idx1, idx2]=intersect(tday1, tday2);

cl1 = adjcls1(idx1);


cl2 = adjcls2(idx2);

enter image description here

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Noob_1
  • 145
  • 3
  • 12
  • 1
    Seems to be just fine. Remember that you need to plot `cl1` against `tday1(idx1)` to make sure the numbering is consistent. – angainor Oct 29 '12 at 14:32
  • Rody, thnx. I know it looks as it should. Thats the problem. But the data is of cl1 is trendwise same but way more volitile in the short term. I am wondering if this is a compiler issue or something. In my old matlab all worked fine. Any ideas? – Noob_1 Oct 29 '12 at 14:56
  • also what do you mean by plot? do u mean chart? – Noob_1 Oct 29 '12 at 14:57
  • 1
    You will need to show us some example data and the problem. Otherwise all seems fine, at least to me. – angainor Oct 29 '12 at 15:02
  • ok uploaded some data.plsease have a look – Noob_1 Oct 29 '12 at 15:22
  • 2
    Based on how you are displaying the data, it might be that tday is not ordered the way you think it is. Try sorting tday, and then use the sorted indices to order idx1 and idx2. – dustincarr Oct 29 '12 at 18:14
  • Dustin, thank you so much! I followed your advice and sorted the index, it was all over the place: worked w/ below code. Thanks again! index1=sort(idx1,'descend'); adjcls(idx, 1)=adjcls1(index1); – Noob_1 Oct 29 '12 at 23:58
  • I recommend you to post this as the answer @dustincarr – Dennis Jaheruddin Oct 30 '12 at 08:59

1 Answers1

1

Based on how you are displaying the data, it might be that tday is not ordered the way you think it is. Try sorting tday, and then use the sorted indices to order idx1 and idx2.

dustincarr
  • 1,365
  • 1
  • 9
  • 14