Azzera filtri
Azzera filtri

Matlab: Fixing colormap to specified values when the solutions at a specific value

1 visualizzazione (ultimi 30 giorni)
I solved the diffusion equation in 2D geometry with fixed boundary conditions and consumption term. How can add to the colormap a new color specifying a certain level of the chemical concentration within the (x-y) graph ? For example, my colormap goes from dark blue to light blue as the solutions change from 100 at the top to 0 at the bottom, how can I add red color to the colormap showing the locations where the solutions are 20?

Risposte (1)

Image Analyst
Image Analyst il 9 Feb 2015
Try something like this:
z=100 * mat2gray(peaks(300)); % Sample data.
imshow(z, []);
% Make colormap.
ramp = linspace(0,1, 100);
blue = ones(1, length(ramp));
colorMap = [ramp; ramp; blue]';
% Make 20'th color red.
colorMap(20,:) = [1,0,0];
colormap(colorMap);
colorbar;

Categorie

Scopri di più su Colormaps in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by