find peak to peak amplitude of an emg signal in matlab

You can find the peak-to-peak amplitude of an EMG signal using the peak2peak function in MATLAB. Here's some example code assuming your EMG signal is stored in a variable called emg_signal:

main.m
% compute peak-to-peak amplitude
amplitude = peak2peak(emg_signal)

% plot the EMG signal and mark the peaks
figure;
plot(emg_signal);
hold on;
[~,locs] = findpeaks(emg_signal);
plot(locs, emg_signal(locs), 'rv', 'MarkerFaceColor', 'r');
[~,locs] = findpeaks(-emg_signal);
plot(locs, emg_signal(locs), 'g^', 'MarkerFaceColor', 'g');
hold off;
legend('EMG signal', 'Positive peaks', 'Negative peaks');
xlabel('Sample index');
ylabel('Amplitude (V)');
450 chars
16 lines

In this code, the peak2peak function computes the peak-to-peak amplitude of the EMG signal. We then plot the EMG signal and mark the positive and negative peaks using the findpeaks function.

related categories

gistlibby LogSnag