Zooming in on a graph / partitioning a data set
5 ビュー (過去 30 日間)
古いコメントを表示
Hello, I have a fairly large data set which has large sinusoids made up of smaller sinusoids. I need to find absolute peaks (i.e. the larger sinusoids). I tried various smoothing mechanisms and nested findpeaks loops to no avail.
So I'm just thinking about biting the bullet and using ginput, clicking on them. However, the data set is large enough and compact enough that even full screen I cannot click on points to a decent precision. (It's over 60000 ms and I don't want to lose specificity). With ginput in effect, I cannot zoom in on the graph.
I also considered using fplot but as the data set is not a function, this does not work.
My questions: Is there a way to partition the graph so that I could have many graphs of a certain length and identify absolute maximums (similar to fplot but workable for data sets)?
and
How would I zoom in on parts of the graph if I am not to partition it?
Thanks a lot!
2 件のコメント
Tom
2012 年 5 月 30 日
If the signal is not too noisy you could use a FFT to get the amplitude of the large sinusoids.
For the graphs, do you mean splitting the data and plotting each set on a separate set of axes?
採用された回答
Tom
2012 年 5 月 30 日
You could use ginput two or three times: the first ones to adjust the x and y limits around the point selected, and the last one to pick the point of interest. Otherwise, you could just plot in a loop- a quick (shoddy) example is below: click on a region, then press return to move to the next plot. This particular code doesn't snap to the data, but you can implement something like that easily (round to the nearest data point, for example)
Data=randn(3500,1);
t=1:length(Data);
NoSamples=1000;
NoPlots=ceil(length(Data)/NoSamples);
for i=1:NoPlots
SampleRange=(i-1)*NoSamples +1:i*NoSamples; %range of data to be plotted
if max(SampleRange) > length(Data) %last set of data might have shorter length
SampleRange=(i-1)*NoSamples +1:length(Data);
end
plot(t(SampleRange),Data(SampleRange))
grid on
[x(i,1),y(i,1)] = ginput(1); %use ginput and save selection
pause %press enter to move to next plot
end
disp([x,y])
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Exploration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!