How do I omit a range of points from line?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
% MATLAB Code
function [dMean, dMax, dMin] = EMGFilter6(EMG)
EMG_2 = EMG;
t = EMG_2(:,1); % time
x = EMG_2(:,2); % signal
d = abs(x);
windowSize = 1000;
b = (1/windowSize)*ones(1,windowSize);
a = 1;
dMean = mean(d);
dMax = max(d);
dMin = min(d);
j = 0.01*dMean;
p = 'concussion';
l = 'no concussion';
y = filter(b,a,d);
for k = i:y
plot(t,d,'color','r')
hold on
plot(t,y,'color','b')
legend('Input Data','Filtered Data')
end
for g = i:y
if g>j
disp(l)
elseif g<j
disp(p)
elseif g == j
disp(l)
end
end
end
% Hello, I'm given a data set of EMG signals. I created a running average mean line for the signal defined by variable "y". I want to omit a range of points from the beginning of the average mean line y so that my running average mean line doesn't start at zero.
0 Kommentare
Antworten (1)
Voss
am 30 Mär. 2022
I'm not sure if this is what you want, but here's how you can remove data before t = 1, for instance:
S = load('data.mat');
EMGFilter6(S.Trial1);
function [dMean, dMax, dMin] = EMGFilter6(EMG)
EMG_2 = EMG;
t = EMG_2(:,1); % time
x = EMG_2(:,2); % signal
% remove t and x before t = 1:
idx_to_remove = t < 1;
t(idx_to_remove) = [];
x(idx_to_remove) = [];
d = abs(x);
windowSize = 1000;
b = (1/windowSize)*ones(1,windowSize);
a = 1;
dMean = mean(d);
dMax = max(d);
dMin = min(d);
% j = 0.01*dMean;
% p = 'concussion';
% l = 'no concussion';
y = filter(b,a,d);
% for k = i:y
% plot(t,d,'color','r')
plot(EMG_2(:,1),abs(EMG_2(:,2)),'r') % plot the entire data
hold on
plot(t,y,'color','b')
legend('Input Data','Filtered Data')
% end
% for g = i:y
% if g>j
% disp(l)
% elseif g<j
% disp(p)
% elseif g == j
% disp(l)
% end
% end
end
1 Kommentar
Siehe auch
Kategorien
Mehr zu Spectral Measurements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
