How to perform clutter removal on this signal?
21 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I am trying to perform clutter removal on this signal attached below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/514557/image.png)
I want to set the signals to zero except a higher peak region in the middle like shown below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/514562/image.jpeg)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/514972/image.png)
8 个评论
回答(2 个)
Image Analyst
2021-2-10
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);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/515592/image.png)
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 个评论
Image Analyst
2021-2-10
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/515632/image.png)
KALYAN ACHARJYA
2021-2-10
编辑:KALYAN ACHARJYA
2021-2-10
@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;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/515052/image.png)
I hope, you can modify it and get your desired result, hence I posted this as an answer.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!