Interpolating(or averaging) Time series curves

3 views (last 30 days)
Hi all, I have two time-series curves (blue and red as shown in the picture) corresponding to two different conditions (T=800, T=900). I would like to make an averaging of the two curves (or interpolation?) to get a curve like the black indicated in the picture corresponding to T=850. Do you have any suggestion how to do it? I was unable to get a code to reproduce the black curve numerically.
Do you think machine learning could be an option?
Many thanks
Input Data:
Red Curve:
0 0
5 0,0100000000000000
5,20000000000000 0,300000000000000
5,30000000000000 10
14 9,80000000000000
14,5000000000000 19
50 17
Blue Curve:
0 0
5 0,0100000000000000
5,20000000000000 0,300000000000000
5,30000000000000 10
10 9,80000000000000
10,5000000000000 19
50 17

Accepted Answer

Mathieu NOE
Mathieu NOE on 19 Jul 2022
hello
in your case it's fairly simple as both blue and red curves have exactly the same y values (but for different x)
so you simply need to do the mean of y blue and red and yu're done !
in case the two data sets would not share the same y values it would be a different situation (but it's also feasible)
%Red Curve:
rc = [0 0;
5 0.01;
5.2 0.30;
5.3 10;
14 9.80;
14.5 19;
50 17];
xr = rc(:,1);
yr = rc(:,2);
% Blue Curve:
bc = [0 0;
5 0.01;
5.2 0.30;
5.3 10;
10 9.80;
10.5 19;
50 17];
xb = bc(:,1);
yb = bc(:,2);
% plot red / blue / black curves
xk = (xr+xb)*0.5; % mean value
yk = (yr+yb)*0.5; % mean value
figure(1)
plot(xb,yb,'b',xr,yr,'r',xk,yk,'k')
  8 Comments
Testscan
Testscan on 19 Jul 2022
Hello again! Thanks a lot for you effort! I have tried the code and it worked fine.

Sign in to comment.

More Answers (0)

Categories

Find more on Interpolation 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!