How to get numerical values of nonlinear implicit function?
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
更多回答(1 个)
John D'Errico
2023-3-19
编辑:John D'Errico
2023-3-19
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!