08.11.2014 Views

Aprenda Matlab 6.1 - Universidad Politécnica de Madrid

Aprenda Matlab 6.1 - Universidad Politécnica de Madrid

Aprenda Matlab 6.1 - Universidad Politécnica de Madrid

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Aprenda</strong> <strong>Matlab</strong> <strong>6.1</strong> como si estuviera en Primero página 104<br />

contour(Z,20,'r--')<br />

contourf(Z, val)<br />

se pue<strong>de</strong> especificar el tipo <strong>de</strong> línea como en la función plot<br />

análoga a contour(), pero rellenando el espacio entre líneas<br />

8.2. Utilización <strong>de</strong>l color en gráficos 3-D<br />

En los dibujos realizados hasta ahora, se ha visto que el resultado adoptaba <strong>de</strong>terminados colores,<br />

pero todavía no se ha explicado <strong>de</strong> dón<strong>de</strong> han salido. Ahora se verá qué sistema utiliza MATLAB<br />

para <strong>de</strong>terminar los colores.<br />

8.2.1. MAPAS DE COLORES<br />

Un mapa <strong>de</strong> colores se <strong>de</strong>fine como una matriz <strong>de</strong> tres columnas, cada una <strong>de</strong> las cuales contiene un<br />

valor entre 0 y 1, que representa la intensidad <strong>de</strong> uno <strong>de</strong> los colores fundamentales: R (red o rojo),<br />

G (green o ver<strong>de</strong>) y B (blue o azul).<br />

La longitud por <strong>de</strong>fecto <strong>de</strong> los mapas <strong>de</strong> colores <strong>de</strong> MATLAB es 64, es <strong>de</strong>cir, cada mapa <strong>de</strong><br />

color contiene 64 colores.<br />

Algunos mapas <strong>de</strong> colores están pre<strong>de</strong>finidos en MATLAB. Buscando colormap en Help<br />

Desk se obtiene –entre otra información– la lista <strong>de</strong> los siguientes mapas <strong>de</strong> colores:<br />

autumn<br />

bone<br />

colorcube<br />

cool<br />

copper<br />

flag<br />

gray<br />

hot<br />

hsv<br />

jet<br />

lines<br />

pink<br />

prism<br />

spring<br />

summer<br />

white<br />

winter<br />

varies smoothly from red, through orange, to yellow.<br />

is a grayscale colormap with a higher value for the blue component.<br />

contains as many regularly spaced colors in RGB colorspace as possible, while attempting to<br />

provi<strong>de</strong> more steps of gray, pure red, pure green, and pure blue.<br />

consists of colors that are sha<strong>de</strong>s of cyan and magenta.<br />

varies smoothly from black to bright copper.<br />

consists of the colors red, white, blue, and black.<br />

returns a linear grayscale colormap.<br />

varies smoothly from black, through sha<strong>de</strong>s of red, orange, and yellow, to white.<br />

varies the hue component of the hue-saturation-value color mo<strong>de</strong>l. The colors begin with red, pass<br />

through yellow, green, cyan, blue, magenta, and return to red.<br />

ranges from blue to red, and passes through the colors cyan, yellow, and orange. It is a variation of<br />

the hsv colormap.<br />

colormap of colors specified by the Axes ColorOr<strong>de</strong>r property and a sha<strong>de</strong> of gray.<br />

contains pastel sha<strong>de</strong>s of pink.<br />

repeats the six colors red, orange, yellow, green, blue, and violet.<br />

consists of colors that are sha<strong>de</strong>s of magenta and yellow.<br />

consists of colors that are sha<strong>de</strong>s of green and yellow.<br />

is an all white monochrome colormap.<br />

consists of colors that are sha<strong>de</strong>s of blue and green.<br />

El colormap por <strong>de</strong>fecto es jet. Para visualizar estos mapas <strong>de</strong> colores se pue<strong>de</strong>n utilizar los<br />

comandos:<br />

>> colormap(hot)<br />

>> pcolor([1:65;1:65]')<br />

don<strong>de</strong> la función pcolor permite visualizar por medio <strong>de</strong> colores la magnitud <strong>de</strong> los elementos <strong>de</strong><br />

una matriz (en realidad representa colores <strong>de</strong> “celdas”, para lo que necesita que la matriz tenga una<br />

fila y columna más <strong>de</strong> las necesarias; ésa es la razón <strong>de</strong> que en el ejemplo anterior a la función<br />

pcolor se le pasen 65 filas y 2 columnas).<br />

Si se <strong>de</strong>sea imprimir una figura en una impresora láser en blanco y negro, pue<strong>de</strong> utilizarse el<br />

mapa <strong>de</strong> color gray. En el siguiente apartado se explica con más <strong>de</strong>talle el dibujo en "pseudocolor"<br />

(pcolor, abreviadamente).<br />

El comando colormap actúa sobre la figura activa, cambiando sus colores. Si no hay ninguna<br />

figura activa, sustituye al mapa <strong>de</strong> color anterior para las siguientes figuras que se vayan a dibujar.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!