Solve for x given y and plot

21 visualizaciones (últimos 30 días)
Lauren McCord
Lauren McCord el 20 de Sept. de 2021
Respondida: Star Strider el 20 de Sept. de 2021
I solved a 2nd Order Differential Equation for the following answer:
y= (2 * e^((2*x)/3)) - ((7*x*e^((2x)/3))/3)
Now, given y=-4, I want to plot and find the value of x when the plot first crosses y=-4.

Respuesta aceptada

Star Strider
Star Strider el 20 de Sept. de 2021
Depending on what you wan, either use fzero or interp1
y = @(x) (2 * exp((2*x)/3)) - ((7*x.*exp((2*x)/3))/3);
x = linspace(0, 2);
yq = -4;
xq = fzero(@(x) y(x) + 4, 1)
xq = 1.4914
xq = interp1(y(x), x, -4)
xq = 1.4914
figure
plot(x, y(x))
hold on
plot(xq, yq, 'r+')
hold off
grid
xlabel('x')
ylabel('y')
.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by