MATLAB Averaging two data with different domains

  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Data domains
AI Thread Summary
The discussion revolves around averaging functions derived from datasets with different domains. The proposed method involves linear interpolation of the functions over new domains followed by averaging the interpolated values. Concerns are raised about the validity of averaging interpolated values, as it may introduce assumptions that could affect data fidelity. However, one participant argues that linear interpolation is adequate given the density of the data and the purpose of concise plotting. The conversation highlights the challenge of handling unequal domains while maintaining the integrity of the data.
member 428835
Hi PF!

Suppose I have three pieces of data: x1 = 0:3:12 and x2 = 0:4:16 and x3 = 0:5:20 with corresponding functions y1 = x1.^2 and y2 = x2.^3 and y3 = x2.^4. How would you average these the "functions" with data (x1,y1) and (x2,y2) and (x3,y3)? My thoughts are:

1) linearly interpolate y1, y2, y3 over a new domain, xnew1 = 0:1:12
2) average y1, y2, y3 interpolations over xnew1
3) linearly interpolate y2 and y3 over xnew2 = 12:1:16
4) average y2,y3 interpolations over xnew2
5) let xnew3 = 16:20
6) average y3 interpolated value over xnew3 (which is just letting y3 take it's values here since no other functions are defined here).

The above is my blueprint, but before I begin, is there an easier way?
 
Physics news on Phys.org
Doesn't make much sense to me to linearly interpolate functions which are known to not be linear.
 
onatirec said:
Doesn't make much sense to me to linearly interpolate functions which are known to not be linear.
Hi onatirec! Looks like you're new, welcome. It's typical to give simple examples to work with the problem, so the linear interpolation is kind of missing what I'm asking. The actual data I'm working with can't be uploaded because it's huge, complicated, and we're publishing with it. But these toy examples are easily reproducible for everyone. If you have any ideas how to answer the above I'd really appreciate it.
 
Well, my point is merely - the general principle of your blueprint makes sense, but I'd be troubled by averaging values which are not real data but interpolations. There are assumptions inherent in interpolation and one would have to take great care to be assured of the fidelity of these resulting data. Simplified as your example is, one can readily see the limitations of the approach in it.
 
onatirec said:
Well, my point is merely - the general principle of your blueprint makes sense, but I'd be troubled by averaging values which are not real data but interpolations. There are assumptions inherent in interpolation and one would have to take great care to be assured of the fidelity of these resulting data. Simplified as your example is, one can readily see the limitations of the approach in it.
The data are pretty dense, so I think linear interpolation is sufficient. Besides, I'm averaging solely for plotting the data concisely, which linearly interpolates regardless. I include the raw data sets as auxiliary files, so the science is preserved. Just need to find a way to average unequal domains. Unless you, or anyone, has a better approach (which I'm very open to) I'm doing th above.
 

Similar threads

Back
Top