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!