File Exchange

image thumbnail

Vectorized Safe Reciprocal

version 1.0 (16.9 KB) by

Accepts an input array and returns reciprocals of individual elements without divide-by-zero errors.



No License

This block accepts an array of inputs and, depending on the individual elements, will return an array of reciprocals of the input.

If an input element is zero, the corresponding output element is assigned a very large number equal to 1/epsilon_machine on most 32-bit computers (epsilon_machine ~= 2.22044604925031e-016)

If the numebr is not zero, it returns the reciprocal of that number in the appropriate output element.

This function will give you the reciprocal of an array without producing divide-by-zero errors.

Comments and Ratings (1)


FG (view profile)

I am new to matlab; how do i use the files posted here?

MATLAB Release
MATLAB 6.5 (R13)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today