HDL Reciprocal
Calculate reciprocal with NewtonRaphson approximation method
Libraries:
Simulink Extras /
Additional Math
Description
The HDL Reciprocal block uses the NewtonRaphson iterative method to compute the reciprocal of the block input. The NewtonRaphson method uses linear approximation to successively find better approximations to the roots of a realvalued function.
The reciprocal of a real number $$a$$ is defined as a zero of the function:
$$f\left(x\right)=\frac{1}{x}a.$$
HDL Coder™ chooses an initial estimate in the range $$0<{x}_{0}<\frac{2}{a}$$ as this is the domain of convergence for the function.
To successively compute the roots of the function, specify the Number of iterations parameter. The process is repeated as:
$${x}_{i+1}={x}_{i}\frac{f\left({x}_{i}\right)}{f\text{'}\left({x}_{i}\right)}={x}_{i}+({x}_{i}a{x}_{i}{}^{2})={x}_{i}.(2a{x}_{i})$$
$$f\text{'}(x)$$ is the derivative of the function $$f(x)$$.
This table shows a comparison of simulation behavior of the HDL Reciprocal block with the Math Reciprocal block:
Math Reciprocal  HDL Reciprocal 

Computes the reciprocal as 1/N by using the HDL divide operator (/) to implement the division.  Uses the NewtonRaphson iterative method. The block computes an approximate value of reciprocal of the block input and can yield different simulation results compared to the Math Reciprocal block. To match the simulation results with the Math Reciprocal block, increase the number of iterations for the HDL Reciprocal block. 
Ports
Input
Output
Parameters
Block Characteristics
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 
