subs D(x)(0)
조회 수: 10 (최근 30일)
이전 댓글 표시
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
Star Strider
2016년 10월 30일
Please post your original differential equation, and describe what you want to do.
채택된 답변
Star Strider
2016년 10월 30일
편집: Star Strider
2016년 10월 30일
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
Karan Gill
2016년 11월 1일
편집: Karan Gill
2016년 11월 1일
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
2016년 11월 1일
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.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
