绘制时间序列MATLAB时的意外日期

时间:2015-11-08 14:22:32

标签: matlab time-series matlab-figure

我试图使用一个字符串的单元格数组来表示timeseries,表示每10秒测量一小时的测量值。下面是我用来绘制这些数据的代码:

Voltages=[230.1,235.1,.......237];
Time={'13:00:10','13:00:20', '13:00:30'........'14:00:00'};

t=timeseries(Voltages, Time); % Using timeseries function in MATLAB

plot(t);

我还添加了两条显示电压上限和下限的直线,这是我得到的图表:

What I currently have

正如您在最终结果中所看到的,x轴上显示了一个意外的日期...

我想做以下其中一项:

  1. 从x轴完全删除日期。
  2. 使用日期字符串06.05.2015我在变量中添加此日期而不是2015年1月1日的意外日期。
  3. 从x轴移除意外日期,然后在文本框中添加06.05.2015。

1 个答案:

答案 0 :(得分:0)

来自timeseries class的文档:

  

<ui-select ng-model="citySelected"> <ui-select-match> {{$select.selected.name + ', ' + $select.selected.country}} </ui-select-match> <ui-select-choices repeat="city in List | filter: {name: $select.search} | orderBy:'sortOrder'"> <span ng-bind-html="city.name + ', ' + city.country| highlight: $select.search"></span> </ui-select-choices> </ui-select> 使用指定的数据和时间创建时间序列对象。

上面的ts = timeseries(data,time)是定义为further down on the same documentation page的“时间向量”:

  

时间载体
  时间序列对象的时间向量可以是数值(双精度)值或有效的MATLAB日期字符串。

     

当时间序列time属性为空时,将以指定单位相对于0(或其他数值)测量数值时间值。在这种情况下,时间向量被描述为相对的(即,它包含与特定开始日期无关的时间值)。

在绘制TimeInfo.StartDate之前,请尝试将timeseries设置为您需要的内容,如下例所示:

TimeInfo.StartDate

结果是:

result of the above plot