subs does not substitutes in the derivation (maura.mon​ville@gmai​l.com)

8 visualizaciones (últimos 30 días)
mauede
mauede el 16 de Nov. de 2015
Respondida: Walter Roberson el 16 de Nov. de 2015
syms s k mu2(s,k) mu3(s,k) Scap(s,k)
Scap = mu3/mu2^(3/2);
dsScap = diff(Scap,s);
dsScap(s, k) =
diff(mu3(s, k), s)/mu2(s, k)^(3/2) - (3*diff(mu2(s, k), s)*mu3(s, k))/(2*mu2(s, k)^(5/2))
mu2(s,k) = 1 + 6*k^2 - 24*k*s^2 + 25*s^4;
mu3(s,k) = 6*s - 76*s^3 + 510*s^5 + 36*s*k - 468*k*s^3 + 108*s*k^2;
subs(dsScap)
ans(s, k) =
diff(mu3(s, k), s)/mu2(s, k)^(3/2) - (3*diff(mu2(s, k), s)*mu3(s, k))/(2*mu2(s, k)^(5/2))

Respuestas (1)

Walter Roberson
Walter Roberson el 16 de Nov. de 2015
subs(dsScap) is not a command. subs() tells MATLAB to process the input expression and return the expression with substitutions. The input variable is not changed. You can assign the result of subs() to a variable.
Because the input variable is not changed, if you have used the input variable elsewhere (such as taking its derivative) then those other locations are not changed.
If you were to assign the result of the subs() on top of the original variable, then other places that used the variable before would also not be changed -- not until you used subs() on them. When you use a symbolic variable in an expression, the symbolic variable is "captured" in the state it was at the time it was used. For example if you have
syms x y z
z = x + y
y = 2 * x
then z will still be x + y, and would not become 3 * x until you did a subs(z)

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by