I'm trying to get the EMG reading in graph form from this file, I was able to get a graph but it looks zoomed out?
3 views (last 30 days)
Show older comments
EDIT: fixed your code so that it runs here
S= load('Exercse 1.mat');
plot(S.data, 'b', 'DisplayName', 'File 2');
0 Comments
Answers (1)
dpb
on 17 Mar 2025
Edited: dpb
on 19 Mar 2025
S= load('Exercse 1.mat');
S
There are a bunch of other data associated with the .mat file that look as though some of those are sampling time related, but we don't know what, specifically, they mean. Things could look different if plotted against actual time as opposed to just against the ordinal index of the observation.
Then again, it well may be you're supposed to be looking only at a specific region in the trace; we have no klew as to what the Exercise objective(s) may be besides not knowing about the details of the data file itself...
S.datastart
S.dataend
S.titles
From the above, it appears there are four separate recordings here and, it looks like, probably three separate measurements of each defined by those starting and ending points in the overall trace.
Just for starters, something like
M=height(S.datastart); % number of separate traces
for i=1:M
subplot(M,1,i) % create a separate axes for each
i1=S.datastart(i,1); % starting point in trace
i2=S.dataend(i,1); % ending point
N=i2-i1+1; % number points in trace
plot(S.data(i1:i2),'displayname',strtrim(S.titles(i,:))) % titles are fixed-length char() arrays
xlim([0 N]) % expand to fit axes width
legend
end
provides a set of traces that look to be stationary appropriate for analyses; still plotted against the ordinal observation as didn't look into the sampling time data to use it to create the time trace(s)...it appears there may be differences there; at least there are multiple values. This also only looks a the first set of the three...
You'll need to read carefully the instructor's notes that must have come with the dataset to fully understand the datasets provided and how to interpret the rest of the information.
Let's see where these are on the original figure...
figure
plot(S.data)
xlim([0 numel(S.data)])
hold on
C='grcm'; % the color mnemonics
T=width(S.datastart); % number of repitions it appears?
for i=1:M % for each measurement type
for j=1:T % for each measurement of the given type
i1=S.datastart(i,j);
i2=S.dataend(i,j);
plot(i1:i2,S.data(i1:i2),'color',C(i),'linestyle','-')
end
end
From the above it appears that the three repetitions would be three separate movements that have been combined into the one long trace...what to do with them individually is undoubtedly provided in the exercise instructions..
1 Comment
William Rose
on 18 Mar 2025
The data file includes simultaneous recordings of biceps and triceps EMGs at three time periods. For each recording, the moving RMS average was computed. (A window width of 25-40 msec is often used - see attached doc for details on why and how to do RMS filtering.) Therefore the data file includes four records for each of the three time periods: the RMS-filtered data and the original data. In your original plot, all twelve segments are plotted consecutively. The marked-up figure below shows how the data is arranged in your original plot. @dpb 's plot shows the four records for trial 1. You can adjust what he did, to make similar plots for trials 2 and 3.

See Also
Categories
Find more on Bar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!