MATLAB Answers

How to use custom X values for the findchangepts function?

3 views (last 30 days)
Leila Alejandra Cababie
Leila Alejandra Cababie on 30 Nov 2020
Answered: Star Strider on 30 Nov 2020
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.

  0 Comments

Sign in to comment.

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
.

  0 Comments

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!