How to perform clutter removal on this signal?
10 views (last 30 days)
Show older comments
Hello everyone,
I am trying to perform clutter removal on this signal attached below.
I want to set the signals to zero except a higher peak region in the middle like shown below.
Any suggestions would be appreciated. The higher peak in the middle have values both in positive as well as negative directions. Signals beyond that regions are set to zero. I am attaching the excel data sheet for this signal.
Attaching two more pictures (from literature, not mine). I am trying to doing something like this.
8 Comments
Answers (2)
Image Analyst
on 10 Feb 2021
Try this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 22;
fprintf('Beginning to run %s.m ...\n', mfilename);
% Read in data.
x=readmatrix('xaxis_data.xlsx')';
y=readmatrix('yaxis_data.xlsx');
[rows, columns] = size(y)
% Define limits of the range we want to view.
lowerLimit = 0.005;
highLimit = 0.010;
% Find the indexes where x is outside the limits because we want to erase there.
badIndexes = x < lowerLimit | x > highLimit;
% Make a copy of the array that will be zeroed out outside of the good range.
cleanedY = y;
cleanedY(badIndexes, :) = 0; % Zero outside the good range.
% Plot the cleaned data.
for k = 1 : size(y, 2)
plot(x,cleanedY(:,k), '-');
hold on;
end
grid on;
xlim([0, 0.015]);
xlabel('x', 'FontSize', 20);
ylabel('y', 'FontSize', 20);
% Put lines on either side of the good range.
darkGreen = [0, 0.7, 0];
xline(lowerLimit, 'Color', darkGreen, 'LineWidth', 3);
xline(highLimit, 'Color', darkGreen, 'LineWidth', 3);
% NOTE: there are no data points exactly at the lower and upper limits.
% so if you want it to be zero EXACTLY up to that point, you'll have to insert those points into the data.
fprintf('Beginning to run %s.m ...\n', mfilename);
NOTE: there are no data points exactly at the lower and upper limits, so if you want it to be zero EXACTLY up to that point, you'll have to insert those points into the data. If you can't figure that out, let me know and I'll do it.
1 Comment
Image Analyst
on 10 Feb 2021
Alright, you just add this:
% Insert points that are zero exactly at the limits.
x = [x; lowerLimit; highLimit];
y(end+1:end+2, :) = 0;
[x, sortOrder] = sort(x, 'ascend');
y = y(sortOrder, :);
The full demo is attached.
KALYAN ACHARJYA
on 10 Feb 2021
Edited: KALYAN ACHARJYA
on 10 Feb 2021
@Adam Danz clearly stated, If you know the x range, which is to be set to zero, then you can directly locate the indices of the corresponding x value range. Which I have shown in my code below. If you are looking for both the peaks and the x data range, then you also have to look for the y data. But there should be a clear definitive understanding of which values need to be set to zero.
x=readmatrix('xaxis_data.xlsx');
y=readmatrix('yaxis_data.xlsx');
temp_y=y;
temp_y(x>0.025 & x<0.18,:)=0;
for i=1:size(y,2)
plot(x,temp_y(:,i));
hold on;
end
grid on;
I hope, you can modify it and get your desired result, hence I posted this as an answer.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!