How do I plot a symbolic function of one variable for a specific set of argument values?

2 vues (au cours des 30 derniers jours)
Say, I have a symbolic function y(x). There is no support for plotting it when x=logspace(1, 5, 101) in fplot(). How do I do it nicely?

Réponses (1)

Walter Roberson
Walter Roberson le 30 Mai 2021
syms y(x)
y(x) = cos(x) * exp(-x/10)
y(x) = 
fplot(y, [10 100])
title('fplot')
X = logspace(1, 2, 101);
Y = double(subs(y, x, X));
plot(X, Y)
title('subs')
  3 commentaires
Valeri Aronov
Valeri Aronov le 3 Juin 2021
I have unaccepted the almost good given answer after a closer examination. I am sorry about being too quick. The purpose of using logspace for x was to spread its values in such a way that they are equidistant on the plot. They are not in the given solution.
Valeri Aronov
Valeri Aronov le 3 Juin 2021
Modifié(e) : Valeri Aronov le 3 Juin 2021
I was too quick again - the acceptable solution seems to be:
Y = double(y)
loglog(Y)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Mathematics 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