Graphics Programs Reference
In-Depth Information
Error in ==> /usr/matlabr12/toolbox/matlab/graph3d/mesh.m
On line 68 ==> hh = surface(x,
,
FaceColor
,
,fc,
,
EdgeColor
,
,
,
flat
,
,
,
FaceLighting
,
,
,
none
,
,
,
EdgeLighting
,
,
,
flat
,
);
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Figure11-1
These error messages indicate that you have tried to plot the wrong kind of
object, and that's why the figure window (Figure 11-1) is blank. What's wrong
in this case is evident from the first error message. While you might think
you can plot the hemisphere
z
=
1
−
x
2
−
y
2
this way, there are points in the
domain
−
1
≤
x
,
y
≤
1 where 1
−
x
2
−
y
2
is negative and thus the square root
is imaginary. But
mesh
can't handle complex inputs; the coordinates need to
be real. One can get around this by redefining the function at the points where
it's not real, like this:
>> [X,Y] = meshgrid(-1:.1:1, -1:.1:1);
>> mesh(X, Y, sqrt(max(1 - X.ˆ2 - Y.ˆ2, 0)))
The output is shown in Figure 11-2.
A Previously Saved M-File Evaluates Differently
One of the most frustrating problems you may encounter occurs when a
previously saved M-file, one that you are sure is in good shape, won't eval-
uate or evaluates incorrectly, when opened in a new session.
Search WWH ::
Custom Search