Borrar filtros
Borrar filtros

showing contour values on plot

12 visualizaciones (últimos 30 días)
Mahmoud Abbas
Mahmoud Abbas el 14 de Abr. de 2022
Comentada: Star Strider el 14 de Abr. de 2022
Hello, how can i show the contour values on the plot?
f = @(x1,x2) exp(-0.05*x1)*sin(x1)+exp(-0.05*x2)*cos(x2);
fcontour(f,[-10 10 -10 10])
colorbar

Respuesta aceptada

Star Strider
Star Strider el 14 de Abr. de 2022
The fcontour function does not have a 'ShowText' property, so overplot it with a normal contour plot and set 'ShowText','on' to show the levels.
f = @(x1,x2) exp(-0.05*x1).*sin(x1)+exp(-0.05*x2).*cos(x2);
figure
hfc = fcontour(f,[-10 10 -10 10]);
Xm = hfc.XData;
Ym = hfc.YData;
Zm = hfc.ZData;
hold on
contour(Xm,Ym,Zm, 'ShowText','on')
hold off
colormap(turbo)
colorbar
.
  2 comentarios
Mahmoud Abbas
Mahmoud Abbas el 14 de Abr. de 2022
You are a superhero, thank you!
Star Strider
Star Strider el 14 de Abr. de 2022
Thank you!
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by