How to get numerical values of nonlinear implicit function?
4 views (last 30 days)
Show older comments
I plotted the following implicit function
k = -1.5
F = @(t,y) log(abs(y)) - y^2/2 - t - k;
fimplicit(F,[0,2],'*')
How do I get the numerical values for every t between 0 and 1, for the function value greater than or equal to y = 1 (the upper part half of the hyperbole)?
0 Comments
Accepted Answer
More Answers (1)
John D'Errico
on 19 Mar 2023
Edited: John D'Errico
on 19 Mar 2023
This is far easier then you may think. Um, trivially so. Just solve for t, as a function of y. Pencil and paper suffice for that. But if you prefer, we can use MATLAB to do the complicated work.
syms t y
k = -1.5;
tsol = solve(log(abs(y)) - y^2/2 - t - k,t)
Yeah, I know, that was complicated. WHEW! You can see it is symmetric as a function of y. negative values of y will yield the same result due to the abs and y^2.
fplot(tsol,[0,5])
xlabel y
ylabel t
grid on
y = (0:0.25:5)';
tfun = matlabFunction(tsol)
t_y = tfun(y);
table(y,t_y)
Not unexpectedly, undefined at y==0, but very simply solved.
To go the other way, you need to recognize there are two solutions for every possible value of t. So that relationship is not single valued. If you allow negative solutions for y, then there are four solutions for any value of t.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!