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

4 Ansichten (letzte 30 Tage)
I need to use difference formula to estimate the derivative of the function f(x) = tanh^4(0.5x) e^−sin2(x).
-

Antworten (2)

Torsten
Torsten am 21 Apr. 2022
Bearbeitet: Torsten am 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 am 21 Apr. 2022
Bearbeitet: Voss am 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)

Community Treasure Hunt

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

Start Hunting!

Translated by