How to get numerical values of nonlinear implicit function?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Romio
el 19 de Mzo. de 2023
Editada: John D'Errico
el 19 de Mzo. de 2023
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 comentarios
Respuesta aceptada
Más respuestas (1)
John D'Errico
el 19 de Mzo. de 2023
Editada: John D'Errico
el 19 de Mzo. de 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 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!