How can I subtract 2 2D graphs made by vectors of different length?
5 views (last 30 days)
Show older comments
Ricardo Fuertes
on 6 Jun 2018
Commented: Ricardo Fuertes
on 6 Jun 2018
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?
0 Comments
Accepted Answer
Image Analyst
on 6 Jun 2018
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.
More Answers (1)
Alfonso
on 6 Jun 2018
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)
0 Comments
See Also
Categories
Find more on Histograms 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!