an EMG signal code

5 visualizaciones (últimos 30 días)
Risso Hasani
Risso Hasani el 10 de En. de 2012
Respondida: nick el 3 de Abr. de 2025
hello all, I'm new here and need your help >.<
I have An Unbiased, Full-rectifed EMG signal... if this signal reaches threshold of 1 it goes ZERO .. else it continues summing until reaching 1 then it resets to zero and so on. Now I could come up with filtration and unbias code... but stuck at the condition and For loop...
Any Help? :)

Respuestas (1)

nick
nick el 3 de Abr. de 2025
Hi Risso,
You can iterate over the signal to apply the threshholding logic as shown below:
emg_signal = [0.2, 0.3, 0.4, 0.5, 0.2, 0.7, 0.1, 0.6, 0.3, 0.5, 0.8];
% Initialize variables
threshold = 1;
cumulative_sum = 0;
processed_signal = zeros(size(emg_signal));
% Iterate over each sample in the EMG signal
for i = 1:length(emg_signal)
% Add the current sample to the cumulative sum
cumulative_sum = cumulative_sum + emg_signal(i);
% Check if the cumulative sum reaches the threshold
if cumulative_sum >= threshold
% Reset the cumulative sum
cumulative_sum = 0;
% Set the output to zero
processed_signal(i) = 0;
else
% Otherwise, set the output to the current cumulative sum
processed_signal(i) = cumulative_sum;
end
end
disp(processed_signal);
0.2000 0.5000 0.9000 0 0.2000 0.9000 1.0000 0 0.3000 0.8000 0
Hope this helps.

Categorías

Más información sobre Specialized Power Systems en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by