plot analytical solution with two solutions

6 Ansichten (letzte 30 Tage)
renee
renee am 27 Dez. 2022
Beantwortet: Tattersall am 28 Dez. 2022
I would like to plot the solution (x,y) of the equation
F = y*exp(-y^2/2)==1/x;
only this has two solutions, a smaller and a larger one. Is it possible to choose one of the solutions (the smaller one), using for example 'solve' and plot it? Thus what I mean is: how to plot the solutions of the system of equations
F = y*exp(-y^2/2)==1/x; with y>1 or y<1
both represent 1 solution.
And how to plot the smaller one until x=1 and herafter plot the larger one?
Thanks!

Antworten (1)

Tattersall
Tattersall am 28 Dez. 2022
I would use the fplot command. The documentation can be found here.
For your example, a solution could be
f = @(y) y*exp(-y^2/2);
ymin = 1;
ymax = 100;
figure;
fplot(f,[ymin ymax]); % ymin and ymax intervals for a solution

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by