an EMG signal code

조회 수: 5 (최근 30일)
Risso Hasani
Risso Hasani 2012년 1월 10일
답변: nick 2025년 4월 3일
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? :)

답변 (1개)

nick
nick 2025년 4월 3일
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.

카테고리

Help CenterFile Exchange에서 Specialized Power Systems에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by