timeseries - addevent plot problem (event ahead/too early)

1 visualizzazione (ultimi 30 giorni)
Jonas
Jonas il 18 Feb 2015
Modificato: Jonas il 18 Feb 2015
Hello community,
I have the following problem: I have to timeseries A and B. If I plot a single timeseries, the max-event (peak) is plotted at the right position, as shown with the code below:
ts1 = timeseries(A(:,2),A(:,1));
ts1.Name = 'Daily mean';
ts1.TimeInfo.Units = 't [days]';
ts1.TimeInfo.StartDate = datestr(min(A(1,1)));
ts1.TimeInfo.Format = 'dd - mm - yy';
ts1.Time = ts1.Time - ts1.Time(1); % Express time relative to the start date.
e1 = max(A(:,2));
e11 = find(e1==A(:,2));
ts1 = addevent(ts1,'Peak',ts1.Time(e11));
plot(ts1,'-b')
If I add the exact same, code with "hold on" and another matrix B the max-event of B will be plotted at the wrong position. As one can see in the figure below, the plot should be in the squared box to the upper right
However, if B is plotted individual, the max-event is plotted at the right spot.

Risposte (0)

Categorie

Scopri di più su Time Series in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by