How can I subtract 2 2D graphs made by vectors of different length?

4 次查看(过去 30 天)
I have 2 sets of data from the same experiment recorded with different methods. The results are 2 graphs describing the same but with some differences. To find those differences I want to subtract the graphs so that I can have a visual representation of where the differences are located.
The problem I have is that the first method has a "X resolution" of 10 data points per second, but the second method's resolution is not constant, sometimes its 7, sometimes its 15. Because of this I can’t just subtract the arrays, since they are not the same length.
Is there a way to do this?

采纳的回答

Image Analyst
Image Analyst 2018-6-6
Yes, just use interp1() to interpolate them to a common time sequence. If you can't figure it out, attach your two vectors in a .mat file, say what you want the new sampling spacing to be, and someone will do it for you.
  1 个评论
Ricardo Fuertes
Ricardo Fuertes 2018-6-6
Thanks! Its works. I had to remove some data points with the same X value, otherwise I would get 'The grid vectors must contain unique points.' error.

请先登录,再进行评论。

更多回答(1 个)

Alfonso
Alfonso 2018-6-6
If you want to quantify the "difference" between 2 datasets of different length, say dataset A with length 100 and dataset B with length 150, you can interpolate the x and y coordinates of dataset A using the "interp1" function to 150 points (length B), then you could for example, calculate the RMSE between the 2 datasets to quantify the differences. (This is one of the ways you could do it)

类别

Help CenterFile Exchange 中查找有关 Histograms 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by