Find the hyperbolic tangent of fi object theta using a CORDIC implementation and specify the number of iterations the CORDIC kernel should perform. Plot the CORDIC approximation of the hyperbolic tangent of theta with varying numbers of iterations.
theta = fi(-2*pi:.1:2*pi-.1);
for niters = 5:10:25
T_cordic = cordictanh(theta, niters);
plot(theta, T_cordic);
hold on;
end
xlabel('theta');
ylabel('tanh(theta)');
legend('5 iterations', '15 iterations', '25 iterations','Location','southeast');
Angle values in radians specified as a scalar, vector, matrix, or
N-dimensional array.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi
niters — Number of iterations scalar
The number of iterations that the CORDIC algorithm performs, specified as
a positive, integer-valued scalar. If you do not specify
niters, the algorithm uses a default value. For
fixed-point inputs, the default value of niters is one
less than the word length of the input array, theta.
For double-precision inputs, the default value of niters
is 52. For single-precision inputs, the default value is 23.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi
T is the CORDIC-based approximation of the hyperbolic
tangent of theta. When the input to the function is
floating point, the output data type is the same as the input data type.
When the input is fixed point, the output has the same word length as the
input, and a fraction length equal to the WordLength –
2.