Subset time series plot

조회 수: 2 (최근 30일)
Bruno
Bruno 2014년 1월 26일
댓글: Bruno 2014년 1월 26일
I have a time series plot (y). I want divide the time series into subsets and subsequently extract the subsets separately. In other word, I want to divide the time series plot into equal chunks.
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2014년 1월 26일
Post a short example
Bruno
Bruno 2014년 1월 26일
I want divide the following plot into 7 equal chunks (subsets) and extract separately
t=0:0.001:10; x=0.2*cos(t) + cos(1.4*t) + 0.8*cos(5.2*t) + 0.02*randn(1, 10001);

댓글을 달려면 로그인하십시오.

채택된 답변

Amit
Amit 2014년 1월 26일
편집: Amit 2014년 1월 26일
t = 0:0.001:10;
x = 0.2*cos(t) + cos(1.4*t) + 0.8*cos(5.2*t) + 0.02*randn(1, 10001);
N = 7; % Number of divisions
I = 1:ceil(numel(t)/N):numel(t);
if (I(end) ~= numel(t))
I = [I numel(t)];
end
for j = 1:N
Y{j,1} = [t(I(j):I(j+1))' x(I(j):I(j+1))'];
end
Here, Y is a cell array where every cell has the T and x subsections.
  댓글 수: 11
Amit
Amit 2014년 1월 26일
The code here plots every subset in a new figure. Thus you can see this.
The code I wrote pretty much covers what you asked. Try MATLAB documentation for different functions used here and you can figure out what changes you need to make from the code here to get what you want. With any effort from your side, this would spoon feeding.
Bruno
Bruno 2014년 1월 26일
Amit, Thank you for your kind cooperation

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by