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 日

1 投票

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 件のコメント

Bruno
Bruno 2014 年 1 月 26 日
I want label the subsections (as m1,m2,m3 ……) on plot.
Amit
Amit 2014 年 1 月 26 日
Once you plot all the sections, you can use
legend('m1','m2' .....)
Bruno
Bruno 2014 年 1 月 26 日
How I can plot all sections? Y is cell array
Amit
Amit 2014 年 1 月 26 日
colorD = 'bgrcmyk';
for j = 1:N
plot(Y{j}(:,1),Y{j}(:,2),colorD(1));
hold on;
end
Bruno
Bruno 2014 年 1 月 26 日
I want see 7 windows that indicate the subsections on plot. I want label the windows
Amit
Amit 2014 年 1 月 26 日
Bruno
Bruno 2014 年 1 月 26 日
I want lines that separate the subsections on plot and I want label each subsection.
Amit
Amit 2014 年 1 月 26 日
titleW = {'w1','w2','w3' ...}; % You fill it
for j = 1:N
figure;
plot(Y{j}(:,1),Y{j}(:,2));
title(titleW{j});
end
Bruno
Bruno 2014 年 1 月 26 日
I have large data sets, I need to see lines or points that indicate the start and end of each subsections on the plot. Subsequently I can select the subsections I am interested.
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 件)

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

質問済み:

2014 年 1 月 26 日

コメント済み:

2014 年 1 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by