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

51 views (last 30 days)
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 Comment
Robin
Robin on 24 Jul 2011
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)

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 24 Jul 2011
Do you want to solve for y(t) rather than for t ? dsolve() really isn't suitable for solving for variables.
  8 Comments
Robin
Robin on 25 Jul 2011
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 on 25 Jul 2011
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.

Sign in to comment.

More Answers (1)

Rohith
Rohith on 9 Oct 2022
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 Comments
Abeda
Abeda on 1 Aug 2023
Is it run on matlab 2021a version? Because, dsolve normally doesn't run on my laptop. Please, help me.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!