Error using cppelt - findchangepts function
8 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I need to get the breakpoints of a time series. I coded
bp = findchangepts(data,'MaxNumChanges',2);
However I obtained
Error using cppelt
The input data type must be either single or double precision
Error in findchangepts>cpmulti (line 241)
[cpmax, minresidue] = cppelt(x, 0, Lmin, statistic);
Error in findchangepts (line 76)
[cp, residue] = cpmulti(x, statistic, Lmin, Kmax);
Apparently, the problem is 'MaxNumChanges',2, because if I skip it, I get a result (only 1 breakpoint). My data type is double precision, so I don't understand what happens
Somebody could help me, please?
Thanks a lot
0 个评论
回答(1 个)
Star Strider
2022-4-17
Your findchangepts call works correctly when I test it here —
t = linspace(0, 10);
data = +(t>4.5); % The '+' Converts 'logical' To 'double'
bp = findchangepts(data,'MaxNumChanges',2)
figure
plot(t, data, t(bp), data(bp), 'pg', 'MarkerSize',11)
grid
ylim([-0.1 1.1])
whos t data
.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
