an EMG signal code

10 Ansichten (letzte 30 Tage)
Risso Hasani
Risso Hasani am 10 Jan. 2012
Beantwortet: nick am 3 Apr. 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? :)

Antworten (1)

nick
nick am 3 Apr. 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.

Kategorien

Mehr zu Specialized Power Systems finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by