overwrite figure(2) on figure(1)

6 vues (au cours des 30 derniers jours)
elena
elena le 2 Déc 2022
MatLab open all the figure except for the number 2 and I can't understand why. In fact if I use:
figure
fplot(f,[-pi,pi])
figure
fplot(g)
it plot the first one in figure(1) and the second one in figure(3). If I would use this code it will overwrite on figure(1).
figure(1)
fplot(f,[-pi,pi])
%
figure(2)
fplot(g)

Réponses (1)

Star Strider
Star Strider le 2 Déc 2022
I am not certain what you are asking. Consider using the hold function to plot two figures on the same axes —
syms x
f = sin(x);
g = cos(x);
figure
fplot(f, [-pi pi], 'DisplayName','sin(x)')
hold on
fplot(g, [-pi pi], 'DisplayName','cos(x)')
hold off
grid
legend('Location','best')
.

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Tags

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by