Filtering timeseries with NaN

조회 수: 4 (최근 30일)
Rebecca Ellis
Rebecca Ellis 2018년 9월 13일
댓글: Rebecca Ellis 2018년 9월 13일
I am filtering out data due to the degree of Standard deviation. Once I determine which rows of data are good, I good back to the orginal data set and try to NaN the rows which are 'bad'.
threshold = 0.0013;
filtRows = find(relSD1 < threshold);
% plot(time, relSD1, '.-');
figure(6)
%plot figure - note that you need to rename my 'time' for your own time vector name
plot(time, f_fluxxcorredit,'.-k');
hold on;
plot(time(filtRows), f_fluxxcorredit(filtRows),'.r');
legend('all data', 'filtered data');
xlabel('Time, hrs');
ylabel('Flux mmol m^{-2} day^{-1}');
shg
How would I get a vector like f_fluxxcorredit (201 points) but with the bad data NaN? Filtrow is showing the good points 112 of them and the others should be NaN of f_fluxxcorredit.

채택된 답변

jonas
jonas 2018년 9월 13일
편집: jonas 2018년 9월 13일
It's easier to use logical indexing. If good data lies below a certain threshold, then bad data lies above that threshold. Switch the sign and use the condition for logical indexing.
This should work:
threshold = 0.0013;
f_fluxxcorredit(relSD1 > threshold)=NaN;
  댓글 수: 1
Rebecca Ellis
Rebecca Ellis 2018년 9월 13일
Great this works, thank you again.

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

추가 답변 (1개)

Peter Perkins
Peter Perkins 2018년 9월 13일
You might take a look at isoutlier and filloutliers.

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by