Graphics Programs Reference
In-Depth Information
the room in the long direction, that is, along the line y = 2. Define a function
that gives the intensity of light at a point ( x , y ) on the floor due to a 150-watt
bulb at a position ( d , 2) on the ceiling.
light2 = inline(vectorize('150/(4*pi*((x - d)ˆ2 + (y - 2)ˆ2 +
3ˆ2))'), 'x', 'y', 'd')
light2 =
Inline function:
light2(x,y,d) = 150./(4.*pi.*((x - d).ˆ2 + (y - 2).ˆ2 +
3. ˆ 2))
Let's get an idea of the illumination pattern if we put one light at d = 3
and the other at d = 7. We specify the drawing of 20 contours in this and the
following plots.
[X,Y] = meshgrid(0:0.1:10, 0:0.1:4); contourf(light2(X, Y, 3)
+ light2(X, Y, 7), 20); axis equal tight
40
35
30
25
20
15
10
5
10
20
30
40
50
60
70
80
90
100
The floor is more evenly lit than with one bulb, but it looks as if the bulbs
are closer together than they should be. If we move the bulbs further apart,
the center of the room will get dimmer but the corners will get brigher. Let's
try changing the location of the lights to d = 2 and d = 8.
contourf(light2(X, Y, 2) + light2(X, Y, 8), 20);
axis equal tight
Search WWH ::




Custom Search