Optimizing zero-crossing indices

16 visualizaciones (últimos 30 días)
Cheeesepondue
Cheeesepondue el 19 de En. de 2019
Comentada: Star Strider el 12 de Mzo. de 2022
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.

Respuesta aceptada

Star Strider
Star Strider el 19 de En. de 2019
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 comentarios
Yash Patel
Yash Patel el 12 de Mzo. de 2022
How can we find the value of zero crosssing points in the form of array.
Star Strider
Star Strider el 12 de Mzo. de 2022
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.
.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by