average of multiple curves matlab

Hello, I have a matrix 203559x2 which corresponds to a data of discharges curves of a battery. Knowing that each charge has about 3622 points(but it is not a fixed value), at the end I have 56 curves. I want to make an average of each 10 curves, and after that I want to overload those average curves to compare their evolutoin.
any help is welcome

2 Comments

The question is not clear. What are the 2 columns? How can the curves be separated? Are the curves strictly decreasing or is there a certain noise between the measurements?
What have yout tried so far? What exactly is your question?
here is an exemple of what I'm trying to do:
M is a matrix 203559x2
X= reshape(M(:,1),[], 56);
Y= reshape(M(:,2),[], 56);
n=10;
for i =1:size(M,2)
X10=mean(X(:,(1+n:2*n),2, 'omitnan');
Y10=mean(Y(:,(1+n:n+n),2, 'omitnan');
n=n+n
end
But I'm missing something. I have another table M_indx is a matrix 56,2 where I have the star line and the end line of the data for each curve, but I dont know how I can use it to write this script.

Sign in to comment.

 Accepted Answer

John D'Errico
John D'Errico on 31 May 2017
This is just a complete guess.
1. You have multiple curves, but they are not of the same "lengths". Essentially, this means the distinct curves are not consistently sampled at the same points.
2. It is impossible to average two curves (two sets of values) if they are not sampled at the same points. But interpolation can allow you to resample curves at a fixed set of locations. Or, you may need to do smoothing, OF the curves have noise in them. In that case, a smoothing spline may be of value.
So resample each curve to the same (consistent) set of locations. That may require smoothing or extrapolation. I strongly advise against much extrapolation using splines, but over a small distance it may be acceptable. Then just perform the averaging over the curves as desired.

More Answers (0)

Categories

Find more on Vehicle Dynamics Blockset in Help Center and File Exchange

Tags

No tags entered yet.

Asked:

on 31 May 2017

Commented:

on 31 May 2017

Community Treasure Hunt

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

Start Hunting!