Plot problem: How to mark a symbol "X".
39 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I had a question to plot two function on a graph, and for each intersection point of two function, mark a symbol "X". I don't know how to do it, Please help me.
0 Kommentare
Antworten (1)
Star Strider
am 6 Mai 2016
If you have calculated the intersection as a (xi,yi) pair, use the hold command, and then:
plot(xi, yi, 'x')
2 Kommentare
Star Strider
am 6 Mai 2016
Bearbeitet: Star Strider
am 7 Mai 2016
My pleasure.
I would have to see your code.
However, if you used fzero, you probably have the ‘xi’ coordinates, and since fzero requires a function that most likely subtracts one function from another, you would use that value in one of the functions you used to calculate ‘xi’ to calulate ‘yi’.
Example:
f1 = @(x) 10 - 5*x;
f2 = @(x) x.^2 + 1;
xi = fzero(@(x) f1(x)-f2(x), 1);
t = linspace(0, 3);
figure(1)
plot(t, f1(t), '-b', t, f2(t), '-g')
hold on
plot(xi, f1(xi), 'xr', 'MarkerSize',20)
hold off
grid
Siehe auch
Kategorien
Mehr zu Calculus 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!