how to solve this differential equation system symbolically?

14 次查看(过去 30 天)

采纳的回答

John D'Errico
John D'Errico 2022-5-1
编辑:John D'Errico 2022-5-1
This seems like a homework problem. But Walter has already given an answer, that I think is not helpful, since dsolve will fail when applied directly. And since the problem is insufficiently defined to be a good homework problem, I might conjecture it is not in fact homework.
syms y(t) x(t) f(t)
dy = diff(y);
E1 = x + dy == f;
E2 = diff(x) + y == diff(f);
First, differentiate E1, subtracting E2 from that.
E3 = simplify(diff(E1) - E2)
E3(t) = 
As you can see, x(t) and f(t) have been completely eliminated from the result. However, now we can solve for y(t).
y(t) = dsolve(E3,y(0) == 0, dy(0) == 1)
y(t) = 
In fact, if you think about it, note that this is a well known function : the hyperbolic sine function.
y = rewrite(y,'sinh')
y(t) = 
Now that we have y(t), return to equations E1 and E2.
E1 = subs(E1)
E1(t) = 
From this we see that x(t) and f(t) are simply related, differening only by that cosh(t) term.
E2 = subs(E2)
E2(t) = 
The problem is, at this point you are now stuck. Lacking f(t) or y(t), you cannot find the other. What is worse, We see that now E1 and E2 are actually the same pieces of information, since we can derive E2 from E1. That is, just differentiate both sides of E1, and look to see what you get.
diff(E1)
ans(t) = 
SURPRISE! Differentiating E1 yields E2.
The point is, you lack sufficient information to solve the problem, even though you can solve for y(t). So perhaps that is the point of this assignment, IF it is one. Anyway, since the problem already had an answer, I might as well have written this.
  1 个评论
Walter Roberson
Walter Roberson 2022-5-1
The approach I used worked fine. I tested with MATLAB Online before I posted. I didn't post the code because it is obvious that it is an assignment.

请先登录,再进行评论。

更多回答(1 个)

Walter Roberson
Walter Roberson 2022-5-1
Create the symbols and the two equations. dsolve() the pair of equations without boundary conditions, getting out a struct with a definition for x and y. Take the y and substitute t = 0 to get y(0) and equate that to the known value. Take the y and differentiate and substitute t = 0 to get y'(0) and equate that to the known value. You now have a pair of simultaneous equations relating the constants of the differential equations.
  6 个评论
Paul
Paul 2022-5-2
编辑:Paul 2022-5-2
But diff(f) is in the equations and is not "plain", so I'm curious why dsolve() chose to solve for x and y, instead of x and f, or y and f, if dsolve() could have done so.
Walter Roberson
Walter Roberson 2022-5-3
Good question. I wonder if it used symvar or equivalent and choose the first two. I seem to recall that solve() chooses variables starting from x y z (or X Y Z) first

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Equation Solving 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by