Optimizing zero-crossing indices

조회 수: 18 (최근 30일)
Cheeesepondue
Cheeesepondue 2019년 1월 19일
댓글: Star Strider 2022년 3월 12일
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')
Capture.PNG
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.

채택된 답변

Star Strider
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
Yash Patel
Yash Patel 2022년 3월 12일
How can we find the value of zero crosssing points in the form of array.
Star Strider
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 CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by