signal processing - remove unwanted portion from the signal

14 views (last 30 days)
The signal in the red circle is the portion that I want as shown in figure below. I have many sets of data similar to the signal below that occur at different time interval. I want to remove the unwanted portion and remain the circled portion. Can anyone teach me how to do it?
Thank you so much.

Accepted Answer

Star Strider
Star Strider on 2 Jun 2022
Try this using envelope to outline the signals, then with a threshold value to choose the desired region —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1019175/Signal%20data.csv', 'VariableNamingRule','preserve');
VN = T1.Properties.VariableNames;
figure
plot(T1{:,1}, T1{:,[2 3]})
grid
xlabel(VN{1})
legend(VN{[2 3]}, 'Location','best')
title('Original Signal')
env1 = envelope(T1{:,[2 3]}, 150, 'peak'); % Calculate 'envelope' Of Both Signals
env1 = max(env1,[],2); % Take The Maximum Across Rows
figure
plot(T1{:,1}, T1{:,[2 3]})
hold on
plot(T1{:,1}, env1, 'LineWidth',2)
hold off
grid
xlabel(VN{1})
legend(VN{[2 3]}, 'Envelope', 'Location','best')
title('Original Signal With Envelope')
Threshold = 1.5; % Detection Threshold For 'env1'
Lv = env1 >= Threshold; % Logical Vector
figure
plot(T1{Lv,1}, T1{Lv,[2 3]})
grid
xlabel(VN{1})
legend(VN{[2 3]}, 'Location','best')
title('Edited Signal')
Change the ‘Threshold’ value to get different results.
.

More Answers (1)

Image Analyst
Image Analyst on 29 May 2022
Sure. We could help but you forgot to attach your signal, which hopefully you'll do after reading this:
In the mean time I'd recomment using movmax and getting a signal where it's less than 10 or so. Then delete those elements. Something like
% Find where signal is in a burst.
maxSignal = movmax(signal, 30);
% Determine which elements have low max value.
quietParts = maxSignal < 10;
% Delete those elements that have low value and are not in a burst.
signal(quietParts) = [];
  1 Comment
Yew Jen Chong
Yew Jen Chong on 2 Jun 2022
Thank you @Image Analyst. It works and I can obtained the signal without the unwanted portion. I have attached the files just in case you need it. Currently I just test the code you written in my code to check whether it is working in my signal.
But I still have a question. How do I matached the time with the signal?
Thank you so much for your help.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!