How to use custom X values for the findchangepts function?

4 views (last 30 days)
I have a series of X and Y data and I want to find change points. I can use the findchangepts function for the Y values and I get a plot but the X axis is just the ID number of the Y point (1, 2, 3 and so on). Is there a way for me to include the X data in the findchangepts calculation? From the documentation there doesn't seem to be much I can do about it, but maybe there's another way.

Answers (1)

Star Strider
Star Strider on 30 Nov 2020
The findchangepts function outputs the change points as a vector of integer indices.
To put them in the context of your data, do somthing like this:
idx = findchangepts(y);
figure
plot(x, y)
yl = ylim;
hold on
plot(x([idx;idx]), yl(:)+zeros(size(idx)))
hold off
grid
.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!