Graphics Programs Reference
In-Depth Information
40 Answers to Exercises
(Part II, Beyond the Basics)
Exercise 7 (Page 74)
To repeat the calculation for the case of 100 nodes, we do the following:
dt = 2*pi/100;
t = dt:dt:100*dt;
x = cos(t)';y = sin(t)';
xy=[xy];
e = ones(100,1);
A = spdiags(e,2 ,100,100) + ...
spdiags(e,50,100,100) + ...
spdiags(e,98,100,100);
A=A+
A';
subplot(221)
spy(A)
subplot(222)
gplot(A,xy)
axis equal off
The next part of the exercise is to change the connection matrix. An
interesting one is the geometrically parallel network:
A = spdiags(e, 25,100,100) + ...
spdiags(e,-75,100,100);
A = fliplr(A);
subplot(221)
spy(A)
subplot(222)
gplot(A,xy)
axis equal off
Exercise 8 (Page 75)
This will produce a list of the ascii
characters corresponding to the
integers from zero to 255:
I = (0:255)';
[int2str(I) blanks(256)' char(I)]
Some of the output is shown below:
Search WWH ::




Custom Search