フィルターのクリア

Cleaning noisy data from a plot

3 ビュー (過去 30 日間)
Mehmet  Emin
Mehmet Emin 2015 年 8 月 14 日
回答済み: Star Strider 2015 年 8 月 14 日
Hi;
I have a regular linear plot from a sensor, but there are some spikes that shouldn't exist actually. I want to eject points that cause these spikes and interpolate the interspaced part. Is there any apps or tools that will help me on it, or shall I build an algorithm which will find these points and eject them?
Thank you in advance.

採用された回答

Star Strider
Star Strider 2015 年 8 月 14 日
If you have the Signal Processing Toolbox, the findpeaks function (with appropriate name-value pair argument choices and parameters) could help you identify the spikes and their locations.
Keep your original independent variable vector, since you’ll need it for the interpolation. Then use the location index vector provided by findpeaks to eliminate them. Then interpolate.
To illustrate:
x = 1:100; % Create Data
y = 1 + 0.1*x.*rand(1,100); % Create Data
spikes = randi(100, 1, 5); % Create Data
y(spikes) = randi(50, 1, 5); % Create Data
[spk,loc] = findpeaks(y,'MinPeakHeight',10); % Find ‘spikes’
xorg = x; % Save Original ‘x’
yorg = y; % Save Original ‘y’
x(loc) = []; % Eliminate ‘spikes’ From Data
y(loc) = []; % Eliminate ‘spikes’ From Data
yint = interp1(x, y, xorg); % Interpolate Missing Data
figure(1)
subplot(2,1,1)
plot(xorg, yorg)
grid
title('Original Data')
yl = get(gca, 'YLim')
subplot(2,1,2)
plot(xorg, yint)
grid
title('Interpolated Data Without Spikes')
set(gca, 'YLim',yl)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeElectrophysiology についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by