color-coding a 2D plot
Mostrar comentarios más antiguos
Hello everybody,
I am wondering how we can plot a 2D figure,x vs. y, which the amplitude of a given mathematical function, let say f(x,y) where e.g. f=sqrt(x.^2+y.^2), is encoded with colors in 2D plot as if max(f) is shown with e.g. blue color and min(f) with red color.
thank you so much, --V
Respuesta aceptada
Más respuestas (2)
Kevin Holst
el 27 de Mzo. de 2012
how about:
[x,y] = meshgrid(-10:0.1:10,-10:0.1:10); % just to get some x and y values
z = sqrt(x.^2 + y.^2);
contourf(x,y,z)
colormap(flipud(jet))
Is that what you're envisioning?
Vahid
el 27 de Mzo. de 2012
0 votos
Categorías
Más información sobre Line Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!