Solve for x given y and plot

14 Ansichten (letzte 30 Tage)
Lauren McCord
Lauren McCord am 20 Sep. 2021
Beantwortet: Star Strider am 20 Sep. 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.

Akzeptierte Antwort

Star Strider
Star Strider am 20 Sep. 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')
.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by