Average of Wave from 10 waves in single graph

15 views (last 30 days)
Hello Everyone,
I have a doubt concerning the average of the wave from a set of waves from sinlge dataset. I need to get a single average curve from all the curves from the figure. I am new to matlab and can not figure it out and have not been able Screenshot (6) .pngto do so for a long time. I need you to help and it would be great for me. Thanks in advance.
  3 Comments
Jan
Jan on 20 Nov 2019
Please calm down. Posting a question twice will confuse the ones who want to help you and maybe waste their time, when they type an answer, which has been given already. Therefore I have cleaned up your identical former question.
You cannot expect the voluntary helpers to post an answer in some minutes. Mentioning, that the problem is "urgent" is counterproductive. See: https://www.mathworks.com/matlabcentral/answers/29922-why-your-question-is-not-urgent-or-an-emergency
There is only one curve in the image, so asking for an average is not meaningful. I guess, you mean that te curve is almost periodic and you want an average period. Then please explain, what the inputs are. It is easier to suggest a matching code, if we do not guess tis detail.
Lokeswara reddy pamulapate
I have the data attched to this. Actually it is the wave of radial artery bloop pressure wave. I want to take the average of all the data to get one average curve from those data.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 20 Nov 2019
Try this:
D = load('P_191005_000.mat');
ap = D.b;
Ts = 1E-3; % Assume Sampling Interval
tv = linspace(0, 1, numel(ap))*Ts; % Create Time Vector
[pks, locs] = findpeaks(-ap, 'MinPeakDist',250, 'MinPeakHeight',-85 ); % Determine Peaks & Indices
figure(1)
plot(tv, ap)
hold on
plot(tv(locs), -pks, '+r')
hold off
grid
for k1 = 1:numel(locs)-1
apc{k1} = ap(locs(k1):locs(k1+1)); % Define Frames
tvc{k1} = tv(locs(k1):locs(k1+1));
len(k1) = numel(locs(k1):locs(k1+1));
end
enstrim = cellfun(@(x)x(1:min(len)), apc, 'Uni',0); % Trim Records To Shortest Length
ensavg = mean([enstrim{:}],2); % Ensemble Average
figure(2)
hold all
for k1 = 1:numel(apc)
plot(tvc{k1}-tvc{k1}(1), apc{k1}) % Plot Frames
end
plot(tv(1:numel(ensavg)), ensavg.', '-r', 'LineWidth',2)
hold off
grid
producing:
Average of Wave from 10 waves in single graph - 2019 11 20.png
  31 Comments
Lokeswara reddy pamulapate
Hi, the pulse pressure can be calculated but I need to calculate the Augmented pressure(Anacrotic notch). from these Aorta and femoral.
Star Strider
Star Strider on 19 Feb 2020
For each pulse, identify the dicrotic notch (that appears to define it), as a point in time using the derivative (or whatever technique you choose), then get the pressure at that point in time.

Sign in to comment.

More Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 20 Nov 2019
Edited: KALYAN ACHARJYA on 20 Nov 2019
Lets say wave are y1,y2,y3.....up to y10..assuming all are having in same x scale
aveg_data=(y1+y2+y3...+y10)/10;
plot(x,aveg_data)
  5 Comments
KALYAN ACHARJYA
KALYAN ACHARJYA on 20 Nov 2019
Edited: KALYAN ACHARJYA on 20 Nov 2019
Can you share two sample data, so that I can test on it?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!