Question: 3. The following Matlab function function y = mytanh (x) y = (exp(x)-exp(-x) ) / (exp(x) +exp(-x) ) for computing tanh(x) = (er-e-x)/( large values

 3. The following Matlab function function y = mytanh (x) y

3. The following Matlab function function y = mytanh (x) y = (exp(x)-exp(-x) ) / (exp(x) +exp(-x) ) for computing tanh(x) = (er-e-x)/( large values of] (say x-1000). Rewrite the code so that it computes accurate values for both large and small values of x whether x is positive or negative. Test your code for the values: x = 10%, k2.-1, 0, 1, 2, 3. Submit your code and your test results. You can compare with the built-in function tanh. e +e*) was found to return NaN for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!