how to find nearest value to zeros?

8 次查看(过去 30 天)
prianka shukla
prianka shukla 2016-3-23
回答: dpb 2016-3-23
i want to write a code to find a time between two values which are nearest one to zeros because i dont have any zeros in my signal.and I dont have any function I have just y values and time values.and between that time wich value of y is exist.thanks

回答(1 个)

dpb
dpb 2016-3-23
If the signal crosses zero, look at
doc fzero
Otherwise, if is all positive the point nearest zero is simply
[ymin,ixmin]=min(y);
Obviously if y<0, min is max or use abs(y). Also, if is monotonic,
doc interp1 % to find intersection closer than nearest computed value
Failing that, there's
doc fminbnd
doc fminsearch

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by