Effacer les filtres
Effacer les filtres

Integrating and substituting

2 vues (au cours des 30 derniers jours)
Mark
Mark le 21 Juin 2012
So I have a long code and now I want to differentiate a formula, y, with respect to x in and integral 0 to t. However, I want to keep the previous x for more calculation and substitute my x. Howe do I do this? Example:
x=5;
syms x
int(y,x,0,t)
I'm convinced I keep to substitue, using sub(), but I am unsure how tis would work out because x is now a plain variable (from syms). Any ideas?

Réponse acceptée

Walter Roberson
Walter Roberson le 21 Juin 2012
Write y in terms of a different symbol, such as X, and
subs(y, X, sym('x'))
to get y in terms of the symbol x (distinct from your variable "x")
Or is y a string instead of a symbolic expression? If it is, then you should be able to do
int(y, 'x', 0, t)
  1 commentaire
Mark
Mark le 26 Juin 2012
I should have accepted this answer long ago. It was spot on!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox 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