I am trying to imput tanh^4(0.5x) e^−sin2(x) into matlab but I am not sure how.

7 views (last 30 days)
I need to use difference formula to estimate the derivative of the function f(x) = tanh^4(0.5x) e^−sin2(x).
-

Answers (2)

Torsten
Torsten on 21 Apr 2022
Edited: Torsten on 21 Apr 2022
syms x
f = (tanh(0.5*x))^4*exp(sin(2*x));
df = diff(f,x)
What is the difference formula ?

Voss
Voss on 21 Apr 2022
Edited: Voss on 21 Apr 2022
Here's how to make a function handle out of f(x), assuming sin2(x) is (sin(x))^2, which you could use for whatever:
f = @(x)tanh(0.5*x).^4.*exp(-sin(x).^2)
f = function_handle with value:
@(x)tanh(0.5*x).^4.*exp(-sin(x).^2)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!