# Superpositions of colored gratings

I created fork grating on mathematica and it is gray tone image, I need to conver it into Black and Blue image instead. And I use the Image code to do that but it didn't work! is there another way to do that?

• Use Colorize[] along with an appropriate Blend[] function. May 25, 2016 at 17:08
• It worked! Thanks :)
– Alaa
May 25, 2016 at 17:19
• Than, can you please write an answer to your own question? :) May 25, 2016 at 17:20

w = w0 (1 + z^2/zR^2);
w1 = 100 200*^-6;
w0set = 2*^-6;
λ0 = 632*^-9;

Ixy2 = FullSimplify[ComplexExpand[(.5 Exp[I (k x + Δϕ)] + .5 Exp[I l ArcTan[y, x]])*Conjugate[.5 Exp[I (k x + Δϕ)] + .5 Exp[I l ArcTan[y, x]]]]];
Grating0 = Ixy2 /. {k -> 11 2 π/λ 0/8, w0 -> w0set, zR -> π w0set^2/λ0, z -> 10*^-4, p -> 0, l -> 0, r -> Norm[{x, y}], Δϕ -> 0};
Grating1 = Ixy2 /. {k -> 11 2 π/λ 0/8, w0 -> w0set, zR -> π w0set^2/λ0, z -> 10*^-4, p -> 0, l -> 1, r -> Norm[{x, y}], Δϕ -> 0};

CFG = MatrixPlot[
Table[
Grating0 + Grating1,
{y, -w1/1000, w1/1000, w1/500000},
{x, -w1/1000, w1/1000, w1/500000}
],
ColorFunction -> "GrayTones",
Frame -> False, PlotRangePadding -> 0, ImageSize -> 768
]


Colorize[CFG, ColorFunction -> (Blend[{Blue, Black}, #] &)]