signal processing - remove unwanted portion from the signal
13 views (last 30 days)
Show older comments
Yew Jen Chong
on 29 May 2022
Commented: Star Strider
on 2 Jun 2022
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.
0 Comments
Accepted Answer
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.
.
2 Comments
More Answers (1)
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) = [];
See Also
Categories
Find more on Parametric Spectral Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!