필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

seperate sample data into sub-vectors

조회 수: 1 (최근 30일)
Christian
Christian 2020년 6월 20일
마감: Christian 2020년 8월 12일
I am currently trying to do a frequency analysis on some sample data from a sensor. Therefore I want to seperate the different sections of the large sample data vector into independent ones. The picture shows the sample data. Each section is a two spiked amplitude with some idling before and after. I figured I could use a threshold to get all the data above set values. But I need some of the iddle before and after that. With the current threshold 5000 samples before the first and after the last data of each amplitude should do.
% determine how many samples there are in total
N=length(SampleData);
% generate sample domain for plot
x=linspace(1,N,N);
PositiveThreshold = 500;
NegativeThreshold = -500;
% get the samples above the threshold
dataIdx = SampleData > PositiveThreshold | SampleData < NegativeThreshold;
SamplePtsAboveThres = x(dataIdx);
How do I get 5000 samples before and after each amplitude and how do I seperate that into independent vecors? Should I use a for loop?
You help is very appreciated!
Edit: I could seperate the vectors by hand but I hoped for something smarter which does that automated.
  댓글 수: 8
dpb
dpb 2020년 6월 23일
Another "trick" is to negate the waveform and then use findpeaks again -- excepting now you're finding minima. I've not played much with it to find a flat top region, but wouldn't put it past being able to make that work pretty well for these data with some experimenting.
Christian
Christian 2020년 6월 24일
Alright, thank you again for your suggestions! I will experiment some more on this.

답변 (0개)

이 질문은 마감되었습니다.

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by