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

3 visualizaciones (últimos 30 días)
I need to use difference formula to estimate the derivative of the function f(x) = tanh^4(0.5x) e^−sin2(x).
-

Respuestas (2)

Torsten
Torsten el 21 de Abr. de 2022
Editada: Torsten el 21 de Abr. de 2022
syms x
f = (tanh(0.5*x))^4*exp(sin(2*x));
df = diff(f,x)
What is the difference formula ?

Voss
Voss el 21 de Abr. de 2022
Editada: Voss el 21 de Abr. de 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