Graphics Programs Reference
In-Depth Information
Figure11-8: TheEditor/Debugger.
K>> [[xvals, xvals]', [ffun(xvals), gfun(xvals)]']
ans =
-1.5000 2.2500
-0.9000 0.8100
-0.3000 0.0900
0.3000 0.0900
0.9000 0.8100
1.5000 2.2500
-1.5000 5.0625
-0.9000 0.6561
-0.3000 0.0081
0.3000 0.0081
0.9000 0.6561
1.5000 5.0625
If we now type
K>> dbcont
we see in the figure window what is shown in Figure 11-9 below.
Finally we can understand what is going on; MATLAB has “connected the
dots” using the points whose coordinates were just printed out, in the or-
der it encountered them. In particular, MATLAB has drawn a line from the
point (1.5, 2.25) to the point ( 1.5, 5.0625). This is not what we wanted; we
wanted MATLAB to join the point (1.5, 2.25) on the curve y = x 2 to the point
(1.5, 5.0625) on the curve y = x 4 . We can fix this by reversing the order of the
Search WWH ::




Custom Search