Time Series analysis problems with date

6 次查看(过去 30 天)
Hi all-and a happy new year (lets hope its better than the last one......)
My query concerns time series.
I have a dataset which consists of 7 seperate excel files, first column is date and second column is a scalar number.
The date is a period of 8 months, jan-aug for 10 years (repeated in each excel file).
I have plotted the first file and the first 8 months plot fine for the ten year period, however, the sep-dec period is also plotted which shows no data, therefore there is a straight line until the next year starts on the graph.
I have used the code
= datevec(cam{:,1}); and also tried
= datenum (cam{:,1});
both do not work!!
So my question is how do I plot the data for just the dates shown which Jan 1st-Aug 31st 2010-2020?
Im fairly new to all this, I have tried using the mathworks help section and tried several other pieces of code, but I get the dreaded red writing, I apologise if this is a billy basic question!
many thanks in advance
Mike
  4 个评论
Adam Danz
Adam Danz 2021-1-17
Is the goal to remove the straight line from the data while maintaining the sept-dec dates along the x axis? Or is the goal to remove the gap completly and jump from Aug to Jan along the x axis?
mike
mike 2021-1-17
Hi Adam,
Ideally to remove the lines and the gaps from the x axis so that I can them smooth and detrend.
Cheers

请先登录,再进行评论。

回答(1 个)

Biral Pradhan
Biral Pradhan 2022-1-25
I understand, you want to remove the straight line as well as x-axis labels corresponding to those 4 months (Sep-Dec) for each year. I assume, you plan on interpolating the data for these 4 months later. While plotting monthly data using datetime values from different tables (as in your case), the axis spacing is determined uniformly, so you get labels separated by 1 calendar month.
I do not think it is possible to abruptly change the spacing from 1 calender month to 4 abruptly. A workaround would be to use a timetable and resample your data.

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by