Optimizing zero-crossing indices
19 次查看(过去 30 天)
显示 更早的评论
filename='AAA'
load = xlsread(filename,1,'C:C');
extension = xlsread(filename,1,'D:D');
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0); % Returns Approximate Zero-Crossing Indices Of Argument Vector
zxidx= zci(load);
figure
plot(extension, load)
hold on
plot(s(zxidx),l(zxidx),'o')

As you can see from the plot, it generally capture the targeted data well. But they are not correct.
I feel like I need to control the zero-crossing indexing function, but I am challenging how to even fine-tune it further.
Thank you.
0 个评论
采纳的回答
Star Strider
2019-1-19
I wrote ‘zci’ so I will do my best to help you with it.
It contains no error checking, so there can be a ‘wrap-around’ effect because of circshift, such that if the end of a sequence is on one side of zero and the beginning of the sequence is on the other, ‘zci’ will consider this a true zero-crossing, even though it is not. That may be what you are seeing. The solution is simply to delete the last index.
(I may consider writing a full function version of it as a File Exchange contribution that checks the ends of the sequence, and automatically deletes the end index in that event. The anonymous function version does not have that option.)
6 个评论
Star Strider
2022-3-12
The ‘zci’ function should produce an array (vector) of indices.
The exact values of the zero-crossings require interpolation of both the independent and dependent variables in a narrow range of indices around each index returned by ‘zci’. This requires a loop.
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

