need to write values on contour plots
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i want to write the objective function value on the contours.
which functiona should i use?
as of now i am using this
---% part of a code--
fcontour(f)
hold on;
plot(x,y,'*-r');
it is giving a following contour lines with different colours which are the values of function "f". so how can i print the values of function in these lines (not red lines).
while f is the function of x &y.
0 commentaires
Réponses (2)
Sudhakar Shinde
le 13 Oct 2020
these examples may help you:
%1
f = @(x,y) exp(-(x/3).^2-(y/3).^2) + exp(-(x+2).^2-(y+2).^2);
fc = fcontour(f);
fc.LineWidth = 1;
fc.LineStyle = '--';
fc.LevelList = [1 0.9 0.8 0.2 0.1];
colorbar
%2
figure
fcontour(@(x,y) x.*sin(y) - y.*cos(x), [-2*pi 2*pi], 'LineWidth', 2);
grid on
title({'xsin(y) - ycos(x)','-2\pi < x < 2\pi and -2\pi < y < 2\pi'})
xlabel('x')
ylabel('y')
0 commentaires
Voir également
Catégories
En savoir plus sur Contour Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!