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

1 次查看(过去 30 天)
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.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Time Series 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by