How can I show the contour plot of two functions in a graph?
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
JJLeov
am 24 Sep. 2015
Kommentiert: T de Vries
am 14 Jun. 2020
I have two contour plots below. I would like to show in the same graph both "contours.
How should I proceed?
Thanks.
x = linspace(-10,10);
y = linspace(-10,10);
[X,Y] = meshgrid(x,y);
Z = X.^2+Y.^2;
figure
contour(X,Y,Z, 'ShowText','on')
x = linspace(-10,10);
y = linspace(-10,10);
[X,Y] = meshgrid(x,y);
Z = X +Y;
figure
contour(X,Y,Z, 'ShowText','on')
0 Kommentare
Akzeptierte Antwort
Star Strider
am 24 Sep. 2015
See if this does what you want:
x = linspace(-10,10);
y = linspace(-10,10);
[X,Y] = meshgrid(x,y);
Z = X.^2+Y.^2;
figure
contour(X,Y,Z, 'ShowText','on')
Z = X +Y;
hold on
contour(X,Y,Z, 'ShowText','on')
hold off
Use the hold function to make multiple plots on one set of axes.
3 Kommentare
T de Vries
am 14 Jun. 2020
Dear Star Strider,
Hopefully, you or someone else, can help me.
I want to make a figure that plots two (and more) contourf plots in the same figure.
For this I used the hold on and hold off as mentioned above, but this is not working unfornutately. Can someone help me?
Kind regards,
Tessa
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Contour Plots 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!