I'm trying to plot this contour graph, but it just does not work?
2 views (last 30 days)
Show older comments
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?
Accepted Answer
More Answers (1)
Walter Roberson
on 25 Jul 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 .
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!