I'm trying to use dsolve to solve this differential equation, but it does not work

22 次查看(过去 30 天)
I'm trying to solve this differential equation using dsolve in matlab, so this is what Im trying to run:
eqn = 'Dy=-exp(y)/(t*exp(y)-sin(y))';
dsolve(eqn,'t')
I know that there is no explicit solution to it, but I was taught that matlab should return a implicit solution. However it doesn't. I've tried it on different versions of matlab, but still no luck. Can someone please help me out?
**this is the error it returns:
??? Error using ==> mupadmex
Error in MuPAD command: wrong 2nd argument [normal]
Error in ==> sym.sym>sym.mupadmexnout at 2003
out = mupadmex(fcn,args{:});
Error in ==> dsolve>mupadDsolve at 190
[var_list,R] = mupadmexnout('mllib::dsolve',sys,x,ignor
Error in ==> dsolve at 97
[R,vars] = mupadDsolve(ignoreConstraints,varargin{1
  1 个评论
Robin
Robin 2011-7-24
this was the original question asked on the assignment btw:
consider the differential equation e^y+(t*e^y - sin(y))*(dy/dt)=0
using dsolve, observe that the solution is given in the form f(t,y)=C
(however I cannot get matlab to give me a solution at all)

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2011-7-24
Do you want to solve for y(t) rather than for t ? dsolve() really isn't suitable for solving for variables.
  8 个评论
Robin
Robin 2011-7-25
I tried it on a an older version of Matlab (2008) and it somehow worked, it gave me the RootOf(_Z-log(-(cos(_Z)-C1)/t)); where _z is the y. C1 is just some arbitrary constant...
Walter Roberson
Walter Roberson 2011-7-25
That must have been a Maple based symbolic toolbox. We can tell that by the fact that it used _Z as the dummy variable for the RootOf(), which is Maple style; MuPad generates an arbitrary variable name that does not start with '_', and MuPad includes that dummy variable name as the second parameter of the RootOf().
It seems, then, that what has been tried works on the Maple symbolic engine, but not on MuPad. Unfortunately I do not have MuPad to test with.

请先登录,再进行评论。

更多回答(1 个)

Rohith
Rohith 2022-10-9
For me, I found that you need to add an option setting Implicit to true.
syms y(t)
eqn = exp(y) + (t*exp(y) - sin(y))*diff(y,t) == 0;
dsolve(eqn, 'Implicit', true)
ans = 
The output was:
- cos(y(t)) - t*exp(y(t)) == C1
  3 个评论
Abeda
Abeda 2023-8-1
Is it run on matlab 2021a version? Because, dsolve normally doesn't run on my laptop. Please, help me.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by