subs D(x)(0)
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
zakaria bouzouf
le 30 Oct 2016
Commenté : Star Strider
le 1 Nov 2016
Hello (sorry for my bad english)
I have a porblem when i want to remplace D(x)(0) with a expression (Xm*sin(w*t+omega) I need it to solve a differentiel equation using Laplace (I must use Laplace for the resolution)* When a use FL=subs(FL,diff(x(t),t),Xm*sin(w*t+omega)) i get the same expression and if a use s instead of t FL=subs(FL,diff(x(t),s),Xm*sin(w*t+omega)) i get D(x)(Xm*sin(w*t+omega) FL is the fuction i get after the transformation of Laplace
Please i need the responce as soon as possible
2 commentaires
Star Strider
le 30 Oct 2016
Please post your original differential equation, and describe what you want to do.
Réponse acceptée
Star Strider
le 30 Oct 2016
Modifié(e) : Star Strider
le 30 Oct 2016
This works (although it uses a soon-to-be-deprecated single-quotes syntax in the subs call):
syms omega omega0 s x(t) Xm tetta
DE = diff(x,2) + omega0^2*x == 0;
LDE = laplace(DE, t, s);
LDE = subs(LDE, {'x(0)', 'D(x)(0)'}, {Xm*cos(tetta), -Xm*omega*sin(tetta)});
LDE = simplify(LDE, 'Steps', 20)
LDE =
omega0^2*laplace(x(t), t, s) + s^2*laplace(x(t), t, s) + Xm*omega*sin(tetta) == Xm*s*cos(tetta)
I usually work with control problems, where initial conditions are by convention zero. It is possible with the dsolve function to include specific initial conditions in the differential equation to be integrated. For some reason, similarly including initial conditions in laplace arguments is not possible.
I consider the inability to include initial conditions in a laplace call to be a ‘bug’ that needs to be corrected.
EDIT — I submitted an Enhancement Request that the syntax for including initial conditions in the arguments be the same for both the dsolve and laplace functions. Let’s hope!
10 commentaires
Karan Gill
le 1 Nov 2016
Modifié(e) : Karan Gill
le 1 Nov 2016
One doesn't need to use single-quote syntax for "subs". Try
Dxt = diff(x,t);
LDE = subs(LDE, {x(0) Dxt(0)}, {Xm*cos(tetta) -Xm*omega*sin(tetta)})
Besides the substitution, could you explain why using Laplace transforms is harder now? That would be really helpful to know.
Karan (Symbolic Math documentation)
Star Strider
le 1 Nov 2016
I didn’t use the syntax you did. That may have been part of the problem.
The other problem I had was in solving the Laplace-domain equation for ‘x(t)’:
LDE = subs(LDE, {'x(0)', 'D(x)(0)','laplace(x(t), t, s)'}, {X0, DX0, X}); % Substitute
For whatever reason, I found that third substitution (where ‘X’ is actually ‘X(s)’) necessary in order to actually solve the equation.
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
