Graphics Programs Reference
In-Depth Information
pos2 = [scr_width/2 + edgethickness,...
edgethickness,...
figwidth,...
figheight];
pos3 = [scr_width/2 + edgethickness,...
scr_height/2 + edgethickness,...
figwidth,...
figheight];
figure('Position',pos1)
figure('Position',pos2)
figure('Position',pos3)
The width of the window border might be different from these on your
computer. There is no way of obtaining these widths from within mat-
lab. You might have to resort to trial and error to get the window
thicknesses exactly right for your computer.
Exercise 15 (Page 118)
Issue the command type gcf and you will see that if there are no figures,
gcf creates one, whereas get(0,'CurrentFigure') doesn't.
Exercise 16 (Page 119)
Did you have fun?
Exercise 17 (Page 123)
The following commands should produce the required display. First we
generate a grid of 100
100 points over the interval [0 , 1]:
×
N=100;
v = linspace(0,1,N);
[x,y] = meshgrid(v);
We want to draw a vertical line at each of the grid points to represent
the vines of the vineyard or trees of the orchard. We string out the x
and y grid points into two row vectors and use matrix multiplication to
duplicate these. The z values, representing the start and end points, go
from zero to a height of 0.01:
x = [1; 1]*x(:)';
y = [1; 1]*y(:)';
z = [zeros(1,N^2); 0.01*ones(1,N^2)];
plot3(x,y,z,'r')
Search WWH ::




Custom Search