Effacer les filtres
Effacer les filtres

signal processing - remove unwanted portion from the signal

22 vues (au cours des 30 derniers jours)
Yew Jen Chong
Yew Jen Chong le 29 Mai 2022
Commenté : Star Strider le 2 Juin 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.

Réponse acceptée

Star Strider
Star Strider le 2 Juin 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 commentaires
Yew Jen Chong
Yew Jen Chong le 2 Juin 2022
@Star Strider. Thank you for helping me.
Star Strider
Star Strider le 2 Juin 2022
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 29 Mai 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 commentaire
Yew Jen Chong
Yew Jen Chong le 2 Juin 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Parametric Spectral Estimation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by