필터 지우기
필터 지우기

Zooming in on a graph / partitioning a data set

조회 수: 4 (최근 30일)
Robert
Robert 2012년 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
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?
Robert
Robert 2012년 5월 30일
I've come to the conclusion that it's pretty noisy. In various attempts, I tried:
-FFT
-multiple "smooth" iterations (aka re-smooth the already smoothed one), and then a double -findpeaks loop which compares peaks with those before and those after
an iteration using "max" over various intervals: sometimes the method above does not work due to the fact that there were some tiny peaks on the climbing or descending side of the larger sinusoid which rose up above their neighbors. However, there are various sections on the graph that are simply flat for several ms and ruin this method.
I am not extremely handy with any of these methods so maybe with fine-tuning I could accomplish what I want, but I am getting to the point where I just want results, even if I have a slightly more painstaking method of getting them (there are probably only about 200 peaks to deal with).
And yes, I mean splitting the data and plotting each set on a separate set of axes; possibly 30 figures each housing 2000 ms, for example.

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

채택된 답변

Tom
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])
  댓글 수: 1
Robert
Robert 2012년 5월 30일
Very reasonable and seems it would work for my purposes. Thanks a lot for the help!

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by