an EMG signal code
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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? :)
0 comentarios
Respuestas (1)
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);
Hope this helps.
0 comentarios
Ver también
Categorías
Más información sobre Specialized Power Systems en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!