additional findchangepts function output
Show older comments
I have two questions regarding function "findchangepts" (DSP Toolbox):
1. How to effectively create additional output vector "x_hat" from standard output "ipt" of the "findchangepts" function at the same sample grid as input data "x". The "x_hat" vector corresponds to function which is piecewise constant or linear approximation of the input "x" signal with jumps at detected change points "ipt" and is produced only as graphics output by "findchangepts" in case of no output variables (see internal function "cpplot" at "findchangepts.m" source code file).
2. Any idea how to choose the input parameters of the "findchangepts" function to restrict output change points only for jump steps values less than some threshold value?
Accepted Answer
More Answers (2)
Greg Dionne
on 23 Nov 2016
0 votes
#2 You can get close to this by running FINDCHANGEPTS once with a given threshold, finding all segments that are too long, and re-running on each of these with lower thresholds.
You'll probably want to explain the motivation behind the request though, so the solution works for you.
1 Comment
Greg Dionne
on 28 Nov 2016
0 votes
I don't think I have a good answer to this. The 'mean' option works by performing a sum residual square error, introducing a constant penalty for each break. So if we have a signal with a small shift in mean over a large number of samples, the sum of the residuals would eventually swamp the computation and force a break (no matter how small the shift). This doesn't seem like what you want. The only other option which takes mean into account is the 'std' option; if your noise is distributed uniformly over all segments, maybe that could work(?). No promises of course, but if you share your data I can try to come up with something practical.
9 Comments
Greg Dionne
on 28 Nov 2016
Thanks for the data. If I'm understanding you correctly, it seems you want to recover the quantized steps, removing just the noise component and leaving the global trend intact. If so, do you also have the global trend that distorts the otherwise flat quantization levels? (see temperatures(:,16) for an example of this) If not, it will be considerably harder.
Michal
on 29 Nov 2016
Greg Dionne
on 29 Nov 2016
The good news is that your trend is slowly varying, so it has a good chance of not surviving operations with diff(). My first thought would be to perform diff, then somehow quantize the results to units of 0.5, then restore via cumsum(). As to the correct DC offset to use, we could use median() on a segment that is fairly long.... maybe find ways to do this taking into account adjacent samples (e.g. groups-of-three). I'll need to think about this.
Greg Dionne
on 30 Nov 2016
This might get you started(?):
findchangepts(unwrap(mod(temperatures(1:3000,16),.0125)*(2*pi/0.0125)),'statistic','linear','Minthreshold',22)
Basically compute the signal modulo .0125, back out the slow trend. use findchangepoints to fix where the trend has residual jumps, then subtract it off. Then round to nearest .0125 after all is said and done...
Michal
on 1 Dec 2016
Greg Dionne
on 2 Dec 2016
I'll take a look at this over the weekend...
Michal
on 19 Dec 2016
Greg Dionne
on 18 Jan 2017
The main problem occurs when the slope of the trend is steep and the quantized levels are moving in the opposing sense. Then it becomes difficult to extract.
Categories
Find more on Measurements and Statistics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!