I'm trying to plot this contour graph, but it just does not work?

2 visualizaciones (últimos 30 días)
I tried to solve this differential equation: e^y+(t*e^y - sin(y))*(dy/dt)=0
using the symbolic solver dsolve, I inputed this and got: RootOf(_Z-log(-(cos(_Z)-C1)/t)) % where C1 is just some arbitrary constant and _Z is the placeholder of Y
so the solution I am trying to graph is this: y-log(-(cos(y))/t)
I first tried to do it by using anonymous equation:
fun=@(t,y) (y-log(-cos(y))./t); [T Y]= meshgrid(-1:0.1:4, 0:0.1:3); contour(T,Y, fun(T,Y),30,'k')
It just gave me a empty graph, so then I tried doing it without anonymous function: [T Y]= meshgrid(-1:0.1:4, 0:0.1:3); Z=(Y-log(-cos(Y))./T); contour(Z,30)
I still get an empty graph.
I do not know if it has to do with the axis or whatever, but I do notice that some of the numerical values are imaginary numbers. Could that have something to do with it? Can someone please help me out?

Respuesta aceptada

Robin
Robin el 25 de Jul. de 2011
I am not sure why matlab was not able to solve for this equation, however if you try to solve for it symbolically using Dt, instead of Dy it works. It would be
dsolve('Dt=t+exp(-y)*sin(y)','y')
which then gives a implicit solution (so then you solve for C and then can plot the contours)

Más respuestas (1)

Walter Roberson
Walter Roberson el 25 de Jul. de 2011
I am not certain at the moment that your approach is correct.
The Maple expression RootOf(Z-log(-(cos(_Z)-C1)/t)) does not mean that _Z is an arbitrary number: rather _Z stands in place there the entire set of numbers, set Z, such that when a member of set Z is substitute in place of _Z in the expression, that the expression enclosed in RootOf() will evaluate to 0. The _Z are, in other words, the root of the equation enclosed in RootOf(), and the _value of the RootOf() expression is logically that set of roots
Varying C1 and t in the RootOf(), I can see that the graph of the roots can look "mostly linear" for some ranges of values, but that if you probe more carefully there are areas it is non-linear, such as along the line C1=t .
  1 comentario
Robin
Robin el 25 de Jul. de 2011
I meant to say C1 is just some arbitrary constant, not Z sorry, I substituted Y for the Z because that is what I was told by my professor, that the Z was just a placeholder for Y. I tried changing C to 1 but still didnt get a graph

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by