Function e^x - e^-x / e^x + e^-x

8 vues (au cours des 30 derniers jours)
Thomas Kozinski
Thomas Kozinski le 10 Mar 2021
Modifié(e) : Matt J le 10 Mar 2021
Hello, I need help with the function. Its task is to determine the values of the function at each point of the linear space and then draw this function using the plot function.
I have a problem already in the first point, I wanted to calculate the values using:
exp (x) -exp (-x) / exp (x) + exp (-x)
and gets error: Undefined function or variable 'x'. How should I solve this problem?
  1 commentaire
Thomas Kozinski
Thomas Kozinski le 10 Mar 2021
Thank you in advance for your help!

Connectez-vous pour commenter.

Réponse acceptée

Matt J
Matt J le 10 Mar 2021
Modifié(e) : Matt J le 10 Mar 2021
For example,
x=linspace(-5,5,100);
plot(x,tanh(x))
  2 commentaires
Thomas Kozinski
Thomas Kozinski le 10 Mar 2021
so should I follow these instructions, it would be correct?
x=linspace(-5,5,100);
exp (x) -exp (-x) / exp (x) + exp (-x)
plot(x,tanh(x))
Matt J
Matt J le 10 Mar 2021
Modifié(e) : Matt J le 10 Mar 2021
It will not throw an error, but I do not know why you have added that 2nd line. The code I gave does exactly what you said you wanted.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by